add a label tag ( above ) so this page shows on the correct menu page
what are the key reference items for this article?
Reference_description_with_linked_URLs_______________________ | Notes_________________________________________________________________ |
---|---|
api-service-mgt-v1 gdoc | |
IT Service Management - Services Management, Maturity and Metrics | |
m Design Patterns | |
m Design | |
Design Tools | |
m Tomcat - Smart Service Model | |
m Apache Data Services | |
s Blockchain Data Privacy & Compliance Services | |
i Message Services | |
/wiki/spaces/KH/pages/33587447 | |
_it_work_notes1 gdoc _it_work_notes1.docx file | SDP concepts that are key *** |
https://medium.com/javascript-scene/the-forgotten-history-of-oop-88d71b9b2d9f | Roots of OOP - Alan Kay Smalltalk keys encapsulation, abstraction, delegation, dynamic associations, collaboration via messages, events, listeners, promises benefits - decoupling to reduce complexity, avoiding shared state, adaptability to change ( CIC policy nbr ) |
Ward Cunningham - Portland Pattern Repository | |
Gang of Four Design Patterns | |
https://www.tutorialspoint.com/design_pattern/factory_pattern.htm | G4 Pattern summary tutorials point |
https://springframework.guru/gang-of-four-design-patterns/ | G4 Pattern summary Spring - 1 page |
JEE Enterprise Services Patterns | |
Enterprise Integration Patterns | |
https://microservices.io/patterns/index.html | Microservices Design Patterns |
https://microservices.io/patterns/monolithic.html | Monolithic Architecture pattern |
https://microservices.io/patterns/microservices.html | Microservices Architecture pattern |
Microservices orchestration vs choreography | |
https://sites.google.com/a/mammatustech.com/ mammatusmain/reactive-microservices | Reactive microservices pattern |
A great C# example of declarative vs. imperative programming is LINQ.
With imperative programming, you tell the compiler what you want to happen, step by step.
For example, let's start with this collection, and choose the odd numbers:
List<int> collection = new List<int> { 1, 2, 3, 4, 5 };
With imperative programming, we'd step through this, and decide what we want:
List<int> results = new List<int>();
foreach(var num in collection)
{
if (num % 2 != 0)
results.Add(num);
}
Here, we're saying:
With declarative programming, on the other hand, you write code that describes what you want, but not necessarily how to get it (declare your desired results, but not the step-by-step):
var results = collection.Where( num => num % 2 != 0);
Here, we're saying "Give us everything where it's odd", not "Step through the collection. Check this item, if it's odd, add it to a result collection."
There are multiple ways to integrate systems or services. APIs is just one method BUT it has strong advantages as a method because it provides better modularity and independence between the consumer and the provider than many other options and supports chain of responsibility pattern. Messaging also provides some added flexibilities for some use cases where modularity, independence and async processing are important. Both APIs and Messaging can benefit from state ledgers for operations management, governance as well.
https://springframework.guru/gang-of-four-design-patterns/
https://microservices.io/patterns/index.html
text starts here
Please see the example applications developed by Chris Richardson. These examples on Github illustrate various aspects of the microservice architecture.
This solution has a number of benefits:
This solution has a number of drawbacks:
There are many issues that you must address.
One challenge with using this approach is deciding when it makes sense to use it. When developing the first version of an application, you often do not have the problems that this approach solves. Moreover, using an elaborate, distributed architecture will slow down development. This can be a major problem for startups whose biggest challenge is often how to rapidly evolve the business model and accompanying application. Using Y-axis splits might make it much more difficult to iterate rapidly. Later on, however, when the challenge is how to scale and you need to use functional decomposition, the tangled dependencies might make it difficult to decompose your monolithic application into a set of services.
Another challenge is deciding how to partition the system into microservices. This is very much an art, but there are a number of strategies that can help:
Shipping Service
that’s responsible for shipping complete orders.Account Service
that is responsible for managing user accounts.Ideally, each service should have only a small set of responsibilities. (Uncle) Bob Martin talks about designing classes using the Single Responsibility Principle (SRP). The SRP defines a responsibility of a class as a reason to change, and states that a class should only have one reason to change. It make sense to apply the SRP to service design as well.
Another analogy that helps with service design is the design of Unix utilities. Unix provides a large number of utilities such as grep, cat and find. Each utility does exactly one thing, often exceptionally well, and can be combined with other utilities using a shell script to perform complex tasks.
In order to ensure loose coupling, each service has its own database. Maintaining data consistency between services is a challenge because 2 phase-commit/distributed transactions is not an option for many applications. An application must instead use the Saga pattern. A service publishes an event when its data changes. Other services consume that event and update their data. There are several ways of reliably updating data and publishing events including Event Sourcing and Transaction Log Tailing.
Another challenge is implementing queries that need to retrieve data owned by multiple services.
There are many patterns related to the microservices pattern. The Monolithic architecture is an alternative to the microservice architecture. The other patterns address issues that you will encounter when applying the microservice architecture.
https://www.softobiz.com/microservice-orchestration-vs-choreography/
Microservice Orchestration Vs Choreography-softobiz.com.pdf
How to stitch these service modules together?
In an orchestra, we have a central man called the “orchestrator”. Therefore, he is responsible for invoking all the sounds.
Similarly, in the microservice orchestration, the orchestrator (central controller) handles all the microservice interactions. It transmits the events and responds to it.
The microservice Orchestration is more like a centralized service. It calls one service and waits for the response before calling the next service. This follows a request/response type paradigm.
Orchestration Benefits
Easy to maintain and manage as we unify the business process at the center.
In synchronous processing, the flow of the application coordinates efficiently.
Limitations
Creating dependency due to coupled services. For example, if service A is down, service B will never be called.
The orchestrator has the sole responsibility. If it goes down, the processing stops and the application fails.
We lose visibility since we are not tracking business process.
It is the other way to achieve microservice interaction.
We want to avoid dependencies in a microservice architecture. So, that each service can work independently. Choreography solves this issue which was the main challenge in orchestration approach.
You can imagine Microservice Choreography as a belle dance (as shown in the above picture). In it, every individual performs steps independently.
Similarly, in microservice Choreography, every microservice performs their actions independently. It does not require any instructions. It is like the decentralized way of broadcasting data known as events. The services which are interested in those events, will use it and perform actions. This is also known as reactive architecture. The services know what to react to, and how-to, which is more like an asynchronous approach.
Benefits
Enables fast processing. As no dependency on the central controller.
Easy to add and update. The services can be removed or added anytime from the event stream.
As the control is distributed, there is no single point failure.
Works well with the agile delivery model, as teams work on certain services rather than on entire application.
Several patterns can be used. For example, Event sourcing, where events are stored, and it enables event replay. Command-query responsibility segregation (CQRS) can separate read and write activities.
Limitations
Complexity is the concerning issue. Each service is independent to identify the logic and react based on the logic provided from the event stream.
The Business process is spread out, making it difficult to maintain and manage the overall process.
Mindset change is a must in the asynchronous approach.
Most of the times, these approaches don’t work well in architecture. So, what is the solution in these use cases?
That is to say, the hybrid approach can solve the problem. For example, if we have a mix of synchronous and asynchronous blocks of activity. So consequently, one or more hybrid pattern can add value to the projects.
Hybrid is the combination of the orchestration approach and choreography. In this approach, we use orchestration within the services whereas we use choreography in between the services.
A Hybrid approach like others is two-edged. Let’s discuss:
Why RDD?
more flexible than reactive services design
doesn't force everything to an API service model - just what should be an API vs a service vs a library vs a function
more natural way to find events produced and consumed by starting with business or client use cases
provides an easier way for business users to drive requirements specifications using natural language ( vs powerpoint logic )
https://sites.google.com/a/mammatustech.com/mammatusmain/reactive-microservices
event maps, event storming in the context of microservices
effective really for software engineers but not so much for others
medium.com-The Forgotten History of OOP.pdf
https://medium.com/javascript-scene/the-forgotten-history-of-oop-88d71b9b2d9f
Wow ! really well done on understanding the value of “intelligent objects”. The Smalltalk features and benefits called out are perfect. I had been developing in other languages for over a decade before picking up Smalltalk ( VisualAge Smalltalk ). Once you have the power, flexibility, protection it was hard to go back to other languages. The other languages are evolving ( as you nicely demonstrate ) to pick up those features. Building in Smalltalk, I could create components that could think for themselves. You could delegate responsibilities to them and they could learn new behaviors. Later I tried the approach with Groovy but it was less elegant. |
assume 2 different orgs on 2 different blockchains on 2 different platforms want to execute a sale using an order (any type of asset )
blockchains implement escrow transaction interface services in a smart contract
2 independent chains A and B can send messages using a common protocol ( gRPC or ??? )
party A wants to buy X from party B for Y currency amount
how to ensure only authorized parties participate in the transactions for settlement of a trade agreement
how to ensure both parties will execute their transaction once and only once to complete the purchase transaction
how to ensure that the purchase is cancelled if either party fails to complete their part of the purchase transaction within the designated time limit
how to prevent either party from failing to deliver or accept delivery of assets or funds per the terms of the trade agreement
network connectivity and interoperability across all related networks
blockchain directory services and access
identity, registration and access management services for all parties in a transaction
each party implements the escrow transaction interfaces as buyer, seller and their agents
each party communicates using one of the supported protocols: gRPC or REST api or ?
each party digital certificates to sign and execute transactions identifying the authorized party
gateway nodes connect 2 different logical blockchain networks directly or indirectly ( blockchain networks normally not physical but virtual overlay networks across multiple provider networks )
use an escrow transaction with smart contracts that
records each parties performance of the obligation
This follows a saga pattern to implement the escrow transaction (eg a purchase ) as a set of linked transactions in smart contracts
Singe Use Tokens are used to guarantee that only this single reservation transaction can be executed once by the designated party
step 0 - party A agrees to buy X from party B for Y currency amount agreeing to a set of policies to execute the transaction for the buyer and the seller roles
step 1 - reservation for payment from A to B with a token, reservation for delivery from B to A with a token
step 2 - when both reservations complete, the reservations are executable as smart contracts by each party
each party executes their reservation transaction via smart contract using the supplied single use token created for just this transaction
A executes B's reservation using the token from B
B executes A's reservation using the token from A
alternate scenarios
both reservations are not completed within the agreed time limit, all reservations and tokens are cancelled and resources revert to current owner control
the purchase policy agreed to may include automated contracts to execute actions to reverse one or both reservation executions or cancel the reservations updating the blockchain
step 3 - if both reservations are not executed as transactions within an agreed time limit, each party is notified to manage the purchase based on agreed policy
step 4 - when both reservations have been executed by each party, all parties are notified of the completion of the escrow transaction
step 5 - any dependent actors are notified of the completion of the purchase which may trigger additional transactions ( eg start an automatic purchase warranty etc )
IF the trade settlement is executed simple on 1 network, real-time using a synchronous model it may work well using simple HTLC
AND both parties fulfill all their obligations to deliver and accept delivery of assets and funds
OTHERWISE 1 or both parties may fail to deliver or accept delivery of the assets or funds for settlement after the trade agreement is set
goals
model
a chain manager ( on a chain ) for other chain transactions ?? ( or a configurable chain model ? )
specific validators only for that transaction type and parties are active
assume 2 different orgs on 2 different blockchains on 2 different platforms want to execute a sale using an order (any type of asset )
a blockchain with 2 parties as nodes each running a ledger copy and a contract
assume direct payment ( no margin loan ) on purchase transaction
blockchains implement escrow transaction interface services in a smart contract
2 independent chains A and B can send messages using a common protocol ( gRPC, API, messages, db transactions or ??? )
party A wants to buy X from party B for Y currency amount
how to ensure only authorized parties participate in the transaction
how to ensure both parties will execute their transaction once and only once to complete the purchase transaction
how to ensure each party will accept delivery of assets and funds
how to ensure that the purchase is cancelled if either party fails to complete their part of the purchase transaction within the designated time limit
network connectivity
blockchain directory services and access
identity, registration and access management services for all parties in a transaction
each party implements the escrow transaction interfaces
each party communicates using one of the supported protocols: gRPC or ?
each party digital certificates to sign and execute transactions identifying the authorized party
gateway nodes connect 2 different logical blockchain networks directly or indirectly ( blockchain networks normally not physical but virtual overlay networks across multiple provider networks )
use an escrow transaction with smart contracts that
records each parties performance of the obligation
This follows a saga pattern to implement the escrow transaction (eg a purchase ) as a set of linked transactions in smart contracts
Singe Use Tokens are used to guarantee that only this single reservation transaction can be executed once by the designated party
step 0 - party A agrees to buy X from party B for Y currency amount agreeing to a set of policies to execute the transaction for the buyer and the seller roles
step 1 - reservation for payment from A to B with a token, reservation for delivery from B to A with a token
step 2 - when both reservations complete, the reservations are executable as smart contracts by each party
each party executes their reservation transaction via smart contract using the supplied single use token created for just this transaction
A executes B's reservation using the token from B
B executes A's reservation using the token from A
alternate scenarios
both reservations are not completed within the agreed time limit, all reservations and tokens are cancelled and resources revert to current owner control
the purchase policy agreed to may include automated contracts to execute actions to reverse one or both reservation executions or cancel the reservations updating the blockchain
step 3 - if both reservations are not executed as transactions within an agreed time limit, each party is notified to manage the purchase based on agreed policy
step 4 - when both reservations have been executed by each party, all parties are notified of the completion of the escrow transaction
step 5 - any dependent actors are notified of the completion of the purchase which may trigger additional transactions ( eg start an automatic purchase warranty etc )
https://www.investopedia.com/terms/h/hashed-timelock-contract.asp
https://academy.binance.com/en/glossary/hashed-timelock-contract
https://medium.com/liquality/hash-time-locked-contracts-htlcs-explained-e88aa99cc824
Refund scenario for HTLC
leverage HTLCs in Atomic Swaps, but also lead industry-wide efforts to standardize their implementation across different applications and blockchains.
https://river.com/learn/bitcoins-utxo-model/
https://www.ecb.europa.eu/pub/pdf/other/stella_project_report_march_2018.pdf
business context and value opportunities
Add the steps involved:
You may also want to use visual panels to communicate related information, tips or things users need to be aware of. |
sample code block
given the analysis above are there any recommended next steps for DMX team members?
Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.
|