Services • Each Service in its own Application Process • Communicating via e.g. HTTP/REST or Messaging • Independently Deployable and Scalable • Built around a specific Business Capability • Owned by a Cross-Functional Team • Aiming at a Maximum of Autonomy
[…] are constrained to produce designs which are copies of the communication structures of these organizations.“ • Agile organisations with highly autonomous teams … do the same!
- on the level of services • Microservices instead aim for replaceability and autonomy • Microservices store “duplicated“ data locally - in a controlled manner • Microservices may store data in the form needed for their service • Event collaboration enables nicely decoupled Microservices
highly autonomous teams and high levels of dev/ops automation. • As desirable as this seems, organisational „success“ may depend on industry and still come in different shapes
money Order:placed Order:delivered • Simple order in the happy scenario ! • Money is collected, e.g. via Credit Card • Items are fetched from inventory • Parcel is shipped
Service Payment Service µS µS µS µS „Reach out to maximise the situations for which you need to change only one service to implement a business requirement!“
Checkout Service Payment Service µS µS µS µS Order1Service µS An Order Service transforms events to commands. May still be asynchronous. May make use of workflow or not. Other services are listening to commands. Money:collected Item(s):fetched Parcel shipped Collect money! Fetch items! Order:placed
overall flow -You may use workflow in that service, or just hardcode the flow -Upside: You have very good management regarding the flow logic -Downside: Some features require change of central „flow service“ „A:few smart:god1services1tell: anemic CRUD:services:what:to:do!” Sam:Newman:(Author of „Building:Microservices“)
by other services. -„Upside“: „no central director“, each endpoint works out its own duty -„Downside: extra work to monitor and track the processes „Systems:tending toward choreoN graphy are more loosely coupled!” Sam:Newman:(Author of „Building:Microservices“)
Service Payment Service µS µS µS µS • The payment service would need a concept of a VIP customer to decide whether to collect directly or issue an invoice later. • But the inventory service would be affected, too. And it would need to know the VIP concept, too. That‘s not good. A:Red Flag !
Checkout Service Payment Service µS µS µS µS Order1Service µS Don‘t use events in a way which are semantical commands. Transforming some events to commands increases Microservices Autonomy.
Service Checkout Service Payment Service µS µS µS µS Order1Service µS „Could potentially take long,:if an:item:is out:of stock. „Will:for all:practical cases always take longer than wanted.: !
Checkout Service Payment Service µS µS µS µS Order1Service µS Core1Process Support1Process The:payment service is a:black box1to the order service team
to deliver their service • It‘s a service team‘s decentral decision how this is implemented • Workflow is an option, if the requirements are tricky or change often • A separate service managing end-to-end flow logic may be necessary • But to avoid god services, each service takes care of its own flow logic • Microservice architectures use events to decentralise data management • For the 95% of cases event collaboration increases service decoupling • But instead of „event chains“ I prefer event-command transformation
µS Money:collected Task:completed Order:delivered Human1Task Service Monitoring Service µS µS Inventory Service Item(s):fetched Inventory Service: with hardcoded flow logic Monitoring: Service: integrates with inventory events
less centrally managed • Microservices Architectures ask for heavily decentral governance • Choreography and Event Collaboration are fundamental to achieve that • Sophisticated End-To-End flow logic may ask for a separate service • Such services transform events to commands offered by other services • Commands may increase autonomy when compared to event chains • Events should trigger additional logic the publisher does not care about • Workflow Tools must be embeddable, composable and integrate „e2e“