MessageType | ID | CorrID | CauseId |
---|---|---|---|
OrderPlaced | 7 | 19 | -1 |
CoockFood | 8 | 19 | 7 |
FoodCooked | 9 | 19 | 8 |
PricedOrder | 10 | 19 | 9 |
ID: unique event id CorrId: Correlation CauseId: Id of event you are responding to
usually placed in headers, not in payload of message/event
in separate branch. Publish/subscribe on correlationIds
Commands added => invert relationship. Now cook nows where to send the messageToPublish to. Changing messageToPublish of operations: pay for food first => it requires big software change. All actors need to change. 4 microservices/teams need to coordinate a release. + downtime. WHTF? :-)
=> Enter process manager (midget)
Cut dependencies between actors. Actors only say that they are done. Midget handles flow.
- started by event (OrderPlaced)
- subscribe to the MidgetHouse
- Map of correlationId. Midgets listen to all events from process correlationId
- subscribe midget to correlationId or subscribe house.
- Threaded handlers important to make actors single threaded.
copy paste TTL with random numbers..
it should throw events when invalid events, state. Now wrong in Cook and in WidgetFactory
Don't change process Make new version of process manager (process definition) What with long running process? Then versions is required. Then it gets ugly. ==> Event sourced process manager It can reinterpert then.
Make topic based pub sub into Event sourced Change Map to Map<string, List< message based>> history
getHistoryFor (Topic)
For event sourcing : deterministic guid generatie, command in same event uid. Try topic replace by event store.
Competing consumers
Still debug locally, can be ran in separate processed. All typical integration issues can be found.