0

I have following scenarios where in Saga

Scenario 1

Bus.Send<SendEmail>(message);
Data.Status = "email send requested";

what if the Database is down for that moment,

  • would the message gets sent?
  • if yes, then the retry (FLR/SLR) would fire which would send the message again?

Scenario2

Bus.Send<SendEmail>(message1); 
some logic/mappers to build up messsage2 // what if this line blows up...?
Bus.Send<SendEmail>(message2);
  • would the message gets sent?
Miral
  • 5,968
  • 16
  • 57
  • 85

1 Answers1

0

In scenario 1, if the database in which the saga is persisted crashes after the saga data was loaded as a part of processing the message which triggered the saga, then the SendEmail message would not be sent and the message which triggered the saga would roll back.

Note, it's not that the call Data.Status = "..." would fail, as that just updates an in-memory data structure which is persisted afterwards.

With regards to scenario 2, you'll have to be more clear: is the logic that bombs that which is invoked as a part of processing the message sent, or is the logic invoked on the line after that Bus.Send(message) ?

UPDATE

Since the logic you're describing in scenario 2 is happening as a result of processing some other message, as long as you haven't turned off the default transactionality of your endpoint, then the messages wouldn't be sent unless the entire process was successful.

Udi Dahan
  • 11,932
  • 1
  • 27
  • 35