Process Manager
See original GitHub issueWhat’s the model to do Process Managers/Sagas/Long running processes or in general, transforming event -> command list
?
I don’t understand well the proposed framework, sorry 😅
Looks like everything is focused on the Command side (command -> 'state -> event' list
) and queries are resolve based on Aggregate state, like “commands with result” (command -> 'state -> result * event' list
), am I right?
I understand that propulsion is meant for subscriptions/projections, but then how is the Query part (of CQRS) fall into place within the Equinox Framework?
I’ll give you an example to illustrate my confusion:
- C: Command
- E: Event
A User Service (like a server) sends a command to a Crawler Aggregate to start the crawling, but the HTTP requests need to go through HTTP Aggregate that will schedule each request and process them later (due rate limits).
When the HTTP Aggregate process the requests it issues an event with the response and a Process Manager “should” pick the events and issue commands to the Crawl Aggregate.
- User Service ->
[C:Start Crawl Process]
-> Crawler Aggregate ->(OK, [E:Crawl Process Started])
E:Crawl Process Started
-> Crawler Process Manager ->[C:Request HTTP]
-> HTTP Aggregate ->(OK, [E:Request Scheduled])
- HTTP Aggregate ->
[E:Request processed]
E:Request processed
-> HTTP Process Manager ->[C:Response delivery]
-> Crawler Aggregate ->(OK, [E: Page analysed; E:Crawl Process finished])
I understand the aggregates (command -> 'state -> event' list
) validate the domain and produce events and I’m using the Process Managers(event -> command' list
) as asyn communication mechanism between Aggregates.
The parts I don’t understand is how the Crawler Process Manager & HTTP Process Manager should be implemented using Equinox, or if that’s not the right model for Equinox, then what would be a valid model to achieve this example?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7
Top GitHub Comments
One thing to watch out for is that you do want to arrive at a situation where each stream has a natural end of life in some fashion - talk. The Epoch mechanism in the process manager PRs is a way to synthetically introduce such a thing, but be careful trying to use that as a hammer; thinking deeply about a good way to structure things is not optional - talk.
Finally, there’s your use of complying in reference to my approx reasons why event sourcing is inappropriate for a context - be careful of confirmation bias in justifying a need (but that doesn’t mean you need to go the other way and take official-sounding classification rules literally either).
None of this is a reason not to just build something in order to explore a range of impl techniques. If the intention is to build some hypothetical domain with a view to demonstrating some technical techniques, go for it (but the whole crawler should really not be a single process manager, no matter what!)
Really appreciate the setting context
Yep; its a tough tradeoff - simple, high performance, testable, easy to scan. Diagrams need to happen and will - they just compete with lots of things…
There unfortunately are no tests I can point to (and FsCheck ones are the worst possible start unless that’s something you happen to already grok.)
Looking forward to it; I’ll endeavour to stay responsive.
Approximately; however I’d say it’s
'event ->
'action`; you can map the state of the process manager to a “next step with gathered context” as you see fit. How you carry out those actions is you writing code, i.e. while this might appear to just write an event, it’s running a command, whose outcome will dictate what you feed back into the process manager (which in turn influences the next action)I’m having trouble unpacking this. Also you don’t “prevent” multiple writers, you define what happens if they happen to conflict (before that you do want to define aggregates as much as possible to minimize such conflicts)
On reflection, while its technically possible to model a web crawler as a process manager, it’s not feeling like there’s a fit to warrant applying event sourcing:
I can’t say I’ve an alternate approach to point to off the top of my head (I prefer to do work than on real things than expand my system design interview skills 😸), but I’m sure there’s plenty well documented approaches to managing such an activity a search away - bloom filters, CRDTs, consistent hashing etc. to distribute the work across multiple nodes tc