Database Reference
In-Depth Information
Beginning an NServiceBus saga
As mentioned earlier, sagas are a design pattern. They are not unique to NServiceBus but
are common in most enterprise service bus systems. There are many references to sagas,
for instance, http://vasters.com/clemensv/2012/09/01/Sagas.aspx and ht-
tp://msdn.microsoft.com/en-us/library/jj591569.aspx . These details are discussed in greater
detail later. For now, we will expand on the payment engine example we have been explor-
ing.
First, a saga in NServiceBus is always started and updated by a message.
Even when a timer is fired, a message is created. This timeout message is to be handled by
the saga—refer to the following class diagram.
In the class diagram, there is message that starts the saga container from Service1; this
means that the message is originated from the service that communicates with the frontend.
A saga data is created and saved to the database. This data may be retrieved when the mes-
sage passes the saga again; this means that the data that was saved for a message from Ser-
vice1 may be retrieved on the return trip from Service2. Therefore, when returning from
the payment service, persisted data can be retrieved and the message can be updated with
data that is not directly passed to the message.
Search WWH ::




Custom Search