Hi,
I have two SqlSagas that sends a message to the same handler and then waits for a reply from that handler. But using the same message from both sagas seems to confuse NSB when it gets the reply from the handler becuase it throws an exception
2018-06-19 10:35:09 [Information] [NServiceBus.Serilog.MessageReceived] Receive message Modules.Messages.ActiveModulesForAccount "b113fbf4-580a-4e10-bdfe-a904008d7e46". 2018-06-19 10:35:09 [Information] [NServiceBus.RecoverabilityExecutor] Immediate Retry is going to retry message 'b113fbf4-580a-4e10-bdfe-a904008d7e46' because of an exception: System.Collections.Generic.KeyNotFoundException: No item found in behavior context with key: NServiceBus.Sagas.ActiveSagaInstance at NServiceBus.Extensibility.ContextBag.Get[T](String key) in C:\BuildAgent\work\b549d46003942065\src\NServiceBus.Core\Extensibility\ContextBag.cs:line 71 at CaptureSagaStateBehavior.Invoke(IInvokeHandlerContext context, Func
1 next)
at NServiceBus.LoadHandlersConnector.Invoke(IIncomingLogicalMessageContext context, Func2 stage) in C:\BuildAgent\work\b549d46003942065\src\NServiceBus.Core\Pipeline\Incoming\LoadHandlersConnector.cs:line 42 at NServiceBus.InvokeSagaNotFoundBehavior.Invoke(IIncomingLogicalMessageContext context, Func
2 next) in C:\BuildAgent\work\b549d46003942065\src\NServiceBus.Core\Sagas\InvokeSagaNotFoundBehavior.cs:line 18
at NServiceBus.DeserializeLogicalMessagesConnector.Invoke(IIncomingPhysicalMessageContext context, Func2 stage) in C:\BuildAgent\work\b549d46003942065\src\NServiceBus.Core\Pipeline\Incoming\DeserializeLogicalMessagesConnector.cs:line 33 at NServiceBus.SubscriptionReceiverBehavior.Invoke(IIncomingPhysicalMessageContext context, Func
2 next) in C:\BuildAgent\work\b549d46003942065\src\NServiceBus.Core\Routing\MessageDrivenSubscriptions\SubscriptionReceiverBehavior.cs:line 29
at NServiceBus.ProcessingStatisticsBehavior.Invoke(IIncomingPhysicalMessageContext context, Func2 next) in C:\BuildAgent\work\b549d46003942065\src\NServiceBus.Core\Performance\Statistics\ProcessingStatisticsBehavior.cs:line 25 at Infrastructure.NServiceBus.ExtractSqlConnectionBehavior.Invoke(IIncomingPhysicalMessageContext context, Func
1 next) in C:\dev\astral\src\Astral\Infrastructure\NServiceBus\ExtractSqlConnectionBehavior.cs:line 37
at NServiceBus.TransportReceiveToPhysicalMessageProcessingConnector.Invoke(ITransportReceiveContext context, Func2 next) in C:\BuildAgent\work\b549d46003942065\src\NServiceBus.Core\Pipeline\Incoming\TransportReceiveToPhysicalMessageProcessingConnector.cs:line 39 at NServiceBus.MainPipelineExecutor.Invoke(MessageContext messageContext) in C:\BuildAgent\work\b549d46003942065\src\NServiceBus.Core\Pipeline\MainPipelineExecutor.cs:line 34 at NServiceBus.Transport.SQLServer.DelayedDeliveryMessagePump.<>c__DisplayClass1_0.<<Init>b__0>d.MoveNext() in C:\BuildAgent\work\1c57be3e94b4bd73\src\NServiceBus.SqlServer\DelayedDelivery\DelayedDeliveryMessagePump.cs:line 23 --- End of stack trace from previous location where exception was thrown --- at NServiceBus.Transport.SQLServer.ReceiveStrategy.TryProcessingMessage(Message message, TransportTransaction transportTransaction) in C:\BuildAgent\work\1c57be3e94b4bd73\src\NServiceBus.SqlServer\Receiving\ReceiveStrategy.cs:line 63 at NServiceBus.Transport.SQLServer.ProcessWithNativeTransaction.TryProcess(Message message, TransportTransaction transportTransaction) in C:\BuildAgent\work\1c57be3e94b4bd73\src\NServiceBus.SqlServer\Receiving\ProcessWithNativeTransaction.cs:line 92
If I create two different messages/handlers then everything works. Is this by design or is it a bug? I thought that NSB should be able to resolve the correct saga from the headers.
Regars,
Tommy