Insist on using events only in between services. It always reduces coupling! Define your business processes as a horizontal, cross-cutting concern! Design service APIs as collections of atomically executable operations! Is Is ”We need consistency!” ”Sure. Events first!” ”What else?” @martinschimak
of accidental coupling @martinschimak Order Service Shipment Service Order placed Goods shipped Payment Service Inventory Service Change service 1 ... Change service 2 ... Change service 3 ... Goods fetched Payment retrieved … we must change three services… ouch!
on using events only in between services. It always reduces coupling! Define your business processes as a horizontal, cross-cutting concern! Design service APIs as collections of atomically executable operations! Is ”We need consistency!” ”Sure. Events first!” ”What else?” @martinschimak
Orches- tration Process logic Process control explicit central implicit decentral Service coupling high low Not necessarily Not necessarily @martinschimak
graphy Orches- tration Process logic Process control explicit central implicit decentral Service coupling high low Not necessarily Not necessarily @martinschimak
not fire the command? And listen to an event? Order Service Fetch goods Retrieve payment Ship goods Payment retrieved Goods fetched Goods shipped Order fulfilled Fire Fire Fire Listen Listen Listen
Payment Service Retrieve payment Payment retrieved Promotions Service Fire essentials as commands and listen to events Customer promoted Act on defined command React to others’ event
on using events only in between services. It always reduces coupling! Define your business processes as a horizontal, cross-cutting concern! Design service APIs as collections of atomically executable operations! ”We need consistency!” ”What else?” Carefully bind by either EVENTor COMMAND to minimise coupling! ”Sure. Events first!” @martinschimak
bind by either EVENTor COMMAND to minimise coupling! Define your business processes as a horizontal, cross-cutting concern! Design service APIs as collections of atomically executable operations! ”We need consistency!” ”What else?” Understand that business processes are a VERTICAL and LOCAL service concern! ”Sure. Events first!” State transitions @martinschimak
Payment Retrieval Service Credit Card Charging Service State transitions State transitions State transitions Retrieve payment Payment retrieved Charge credit card Credit card charged Fulfill order Order fulfilled Seconds to weeks Seconds Days to months Payment failed Order not fulfilled Credit card expired
we see a „command“ as the intent to change a write model... … but the customer‘s or service clients intent is often targeted at a more valuable business result, which needs many intermediate steps to be achieved. Retrieve payment Atomic, trans- actional view Composite, long- running view Payment requested Payment retrieved @martinschimak
bind by either EVENTor COMMAND to minimise coupling! Understand that business processes are a VERTICAL and LOCAL service concern! Design service APIs as collections of atomically executable operations! ”We need consistency!” ”What else?” ”Sure. Events first!” Services are small state machines State transitions Design service APIs around RESPONSIBLE and LONG-RUNNING capabilities! @martinschimak
Retrieval Service Retrieve payment Payment retrieved Customer Promotion Service Take care of a coarse grained order fulfillment Customer promoted Act on command and take care of payment React to event and take care of promotion
Process logic Process control explicit central implicit decentral Service coupling high low Not necessarily Not necessarily Not necessarily Not necessarily @martinschimak Not necessarily Not necessarily
Event Command Process logic Process control Intent Customer & Supplier Outcome Outcome & Reaction Service coupling By Sender By Receiver @martinschimak I need both! I need both! I need both!