Processor
A Processor is an abstract vital definition with several concrete manifestations (see below) that represents any definition capable of processing messages. Processors have handlers to process messages sent to them, and can have inlets and outlets for receiving and sending messages in streams.
Concrete Processor Types¶
The following definitions are all processors:
- Adaptor — translates messages between contexts
- Context — a bounded context (has exactly one handler)
- Entity — stateful business object (can have multiple handlers per state)
- Projector — projects events into queryable data
- Repository — persistent storage abstraction
- Streamlet — stream processing component
- Saga — distributed transaction coordinator
Message Delivery¶
Messages can be delivered to a processor in two ways:
- To an inlet — for stream-based message flow
- Directly to the handler — via the
tellstatement for point-to-point messaging
Inlets¶
An inlet provides the name and data type for an input to the processor. There can be multiple inlets or none. A processor with no inlets is called a source since it originates data by itself.
Outlets¶
An outlet provides the name and data type for an output from the processor. There can be multiple outlets or none. A processor with no outlets is called a sink since it terminates data flow.
Kinds Of Processors¶
The kind of processor depends on the number of inlets and outlets defined:
| # Inlets | # Outlets | Kind | Description |
|---|---|---|---|
| 0 | any | Source | Originates data and publishes it to outlets |
| any | 0 | Sink | Terminates data flow by consuming from inlets |
| 1 | 1 | Flow | Transforms data from one inlet to one outlet |
| 1 | any | Split | Routes data from one inlet to multiple outlets |
| any | 1 | Merge | Combines data from multiple inlets to a single outlet |
| any | any | Multi | Any other combination is a many-to-many flow |
Handlers¶
A processor contains handlers that specify how the business logic should proceed. For sources, sinks, and flows, this is straightforward. For splits, merges, and multis, the handler specifies how messages received on inlets are transformed and routed to outlets.