Simon
Simon

Reputation: 34840

What happens in a NServiceBus Saga when the IAmStartedBy Message comes after the IHandle Message?

I have an NServiceBus Saga that looks like this

public class MySaga : Saga<MySagaData>,
                                IAmStartedByMessages<MyStartMessage>,
                                IHandleMessages<OtherMessage>

But messages can come out of order. So what happens when the IAmStartedBy Message comes after the IHandle Message? There will be no SagaData for OtherMessage. Will NServiceBus swallow the message or try to re-handle it later?

Upvotes: 5

Views: 1098

Answers (1)

Andreas &#214;hlund
Andreas &#214;hlund

Reputation: 5273

NServiceBus will fail to find an active saga for OtherMessage, retry the configured number of times and then put the message in the error queue. The retries might delay long enough for MyStartMessage to arrive. Any reason why OtherMessage can't start the saga as well? (you can have multiple messages that can start a saga)

Upvotes: 5

Related Questions