0 karma · joined April 8, 2019
I love you. Will definitely give bus-workflow a thorough shot.
And a very last question if you could spare a bit more time..
Again the user signup & event flow,
When Workflow calls EmailService.sendEmail (given that the communication is via RPC and EmailService.sendEmail is an async operation that will resolve if the email was sent successfully), should Workflow wait for the sendEmail operation to resolve and complete the flow? Or should EmailService dispatches an event EmailSent so that Workflow can complete the flow?
This is a bit off the topic but I've been sticking with RPC style call rather than Events but still don't know yet what the best practice is.
Many Thanks
E.g., 1. Browser requests with UserSignup event (or API gateway receives it, do not call UserService but emits event)
2. Workflow receives the event, then calls UserService.signupUser activity
3. UserService creates a user then return the call back to Workflow
4. Workflow resolves the call(singupUser) then calls EmailService.sendEmail
5. EmailService.sendEmail sends an email then calls back to Workflow
6. Workflow resolves the call(sendEmail) then the flow is completed
The difference is that Every workflows will be defined inside Workflow and Services won't serve requests directly, which I believe this gives a complete view to the flow.
However there must be something that I'm missing here since what I'm describing seems like an anti pattern.
Say, I have two services deployed individually working in their own domains.
UserService and EmailService
When the task is a simple user signup & welcome email
1. Workflow requests UserService.signupUser
2. UserService.signupUser creates User, then dispatches UserCreated event.
From my understanding, this is where it's different between having Workflow and not having it.
3. Workflow receives UserCreated event, then requests EmailService.sendEmail
IF I did not have Workflow in my design, then EmailService will be listening to UserCreated event from UserService directly.
It sounds almost same as having an orchestration service called UserSignup Service, and do the same thing what Workflow does.
Can you say my understanding correct? Thanks!