The main purpose of a process manager is to encapsulate the process specific logic and maintain a central point of control. It’s initiated by a trigger message which could be an event coming out of a bounded context.
NOTE:
It's important to note that the process manager does not perform any business logic. It only routes messages, and in some cases translates between message types.
Microsoft also echoes that:
You should not use a process manager to implement any business logic in your domain. Business logic belongs in the aggregate types.
Typically process managers are using events as inputs, maintain an internal state and produce commands as outputs.
The following things are essential for process managers:
- Process managers are stateful actors.
- They are strictly consistent with their owned state.
- Publishing commands is strictly consistent with state changes.
The above means that process managers' state cannot be a simple eventually consistent projection. Process managers either update the state and send messages, or do none of that.
The requirement of being transactionally consistent between the state and published messages implies using the Transactional Outbox pattern.