Accessing a database or webservice in a saga

sagas
nservicebus

(Peter Mihalik) #1

Hi, I’m reading https://docs.particular.net/nservicebus/sagas/#accessing-databases-and-other-resources-from-a-saga and I’m wondering why a saga shouldn’t access a database or do a webservice call? What is the motivation? What can / will go wrong?

Thanks,
Peter


(Szymon Kulec) #2

Hey Peter,

sagas are meant to be coordinators of processes, not implementations of whole processes. Every single step, like doing a service call, or processing some data should be addressed using a regular handler. A single saga instance, should obtain all the data needed to proceed from its inputs (messages) and communicate with the rest of the world with messages as well. It’s a powerful coordinator, but still, just a coordinator.

Does it answer your question?

Cheers,
Szymon


(Peter Mihalik) #3

Yes, thank you.

Peter