Event-Driven

Fan-out / Fan-in

Description

Fan-out broadcasts a message to multiple processors. Fan-in aggregates results from parallel executions.

Where to use

  • Parallel processing.
  • \n
  • Batch jobs.

Real World Example

An Order is placed (Fan-out). Inventory, Email, and Fraud services process it in parallel. Once all 3 reply (Fan-in), the order is confirmed.

Code Example

class Fan-out/Fan-in:\n    def __init__(self):\n        pass\n\n    def execute(self):\n        print('Executing Fan-out / Fan-in')