481079 (3) [Avatar] Offline
The microservices my company has are written in Node.js and they implement a REST API. When reading your book and looking at the code, i can understand the concept of sagas in Java but i'm struggling to see how that would be implemented in Node.js. Most of the google search results point to me to redux-saga for React/Redux applications which is again not applicable to my use case.

It would be very useful if you or someone who understands the Saga concept fully, explain to me how this would be written in Node.js if it's even applicable. I've seen ES6 Generators mentioned quite often, is that the way to go?

ceracm (79) [Avatar] Offline
It probably doesn't help that the term saga is overloaded with some novel uses such as the ReactJS example you mentioned:

It is a best to think of a saga (orchestrator) as

1. A state machine that exchanges messages with saga participants
2. A persistent object in the database

Its a higher-level concept that the language features like generators that you mentioned.

Here is a talk that I gave on the subject: https://www.slideshare.net/chris.e.richardson/gluecon-using-sagas-to-maintain-data-consistency-in-a-microservice-architecture and here is a video: https://www.youtube.com/watch?v=YPbGW3Fnmbc&t=26s

Things will become a lot clearly once I release the code, which should happen soon.

481079 (3) [Avatar] Offline
I'm getting closer to understanding the concept of Sagas and the presentation you referenced actually cleared a lot of things.

Thank you for the reply. Looking forward to your completed book.
ceracm (79) [Avatar] Offline

I am concerned though.
The book should be easier to understand than the presentation!
Are there things in the presentation that are missing from the book?
481079 (3) [Avatar] Offline
I think it was a combination of things. When reading a book, you can become overwhelmed with new concepts and terminologies and some things are not clear whereas your presentation focused only on Sagas and nothing else. Slides 24-26 helped a lot as it was applicable to my use case.

One thing i would say is that the code examples should be separate to the theory maybe in an Appendix somewhere. For a non Java developer, they can be confusing and a bit misleading, however diagrams are universal and very helpful. That is just my opinion and i am by no means an expert.