Particular / NServiceBus

Build, version, and monitor better microservices with the most powerful service platform for .NET
https://particular.net/nservicebus/
Other
2.07k stars 647 forks source link

Saga not found when two sagas handle same event #2787

Open kevin-whalley-gc opened 9 years ago

kevin-whalley-gc commented 9 years ago

I have an endpoint with two sagas with separate state. When both of the sagas implement IHandle(SomeMessage) and the mapping is configured in ConfigureHowToFindSaga for SomeMessage, Saga A will correctly invoke SagaNotFound, but Saga B which does have the state for handling (SomeMessage) also invokes SagaNotFound which is not expected.

Can you shed light on this behavior? Version 5.1.3

andreasohlund commented 9 years ago

Does both sagas have the mapping?

kevin-whalley-gc commented 9 years ago

Both sagas have a mapping for the same Type

andreasohlund commented 9 years ago

This api is unfortunately a bit broken and we've talked about improving it https://github.com/Particular/NServiceBus/issues/2080 :(

In this case since IHandleSagaNotFound is "global" we call it since there was a saga with mapping for the given message that wasn't found.

I know this isn't what you wanted to hear, I'll do some digging to see if I can figure out a workaround

kevin-whalley-gc commented 9 years ago

The workarounds we thought of were merging the two sagas into one with some switch logic (we went this route) and creating a separate endpoint.

No need to do some digging, we'll just appreciate it when the API is improved.

andreasohlund commented 9 years ago

No need to do some digging, we'll just appreciate it when the API is improved.

Thanks for the feedback, I'll keep you posted on the progress via this issue.

Again, really sorry for the crappy experience we definitely need to improve here