Event-Driven

Event-Carried State Transfer

Description

The event itself contains all the data the consumer needs. The consumer doesn't need to contact the producer for more info.

Where to use

  • High decoupling.
  • \n
  • Reducing network chatter.

Real World Example

The 'OrderCreated' event includes the full item list, shipping address, and total amount. The Shipping Service can generate a label without calling the Order API.

Code Example

class Event-CarriedStateTransfer:\n    def __init__(self):\n        pass\n\n    def execute(self):\n        print('Executing Event-Carried State Transfer')