I am trying to create a small POC in order to see how I can have a hybrid solution with
two MSMQ endpoints and two AzureServicebus endpoints. Here are the issues I’m currently facing:
When I enable Outbox on my MSMQ endpoint, nservicebus control message (from event subscription) fails
*info: NServiceBus.SubscriptionReceiverBehavior[0]*
* Subscribe from NServiceBusOutboxPOC.ASB.PubSubEndpointA@MCC23-MIDEBLOIS on message type NServiceBusOutboxPOC.Shared.ProductInserted,Version=1.0.0*
*info: NServiceBus.ImmediateRetry[0]*
* Immediate Retry is going to retry message '14223e81-196b-4ee5-852c-5c5a3626462b\32009' because of an exception:*
* System.NullReferenceException: Object reference not set to an instance of an object.*
* at NServiceBus.Persistence.AzureTable.OutboxPersister.SetAsDispatched(String messageId, ContextBag context, CancellationToken cancellationToken) in /_/src/NServiceBus.Persistence.AzureTable/Outbox/OutboxPersister.cs:line 77*
* at NServiceBus.TransportReceiveToPhysicalMessageConnector.<Invoke>d__1.MoveNext() in /_/src/NServiceBus.Core/Pipeline/Incoming/TransportReceiveToPhysicalMessageConnector.cs:line 67*
If I remove the event subscription inside my bridge configuration, my event handler is still triggered (event published from MSMQ, handler inside AzureServiceBus endpoint)
When I enable Outbox on my MSMQ endpoint, nservicebus control message (from event subscription) fails
This seems to indicate that something is off with the outbox configuration of the MSMQ endpoint, can you share the code for that endpoint? (Or perhaps share the entire POC, you can send it to support@particular.net if it contains code that you can’t share publicly)
If I remove the event subscription inside my bridge configuration, my event handler is still triggered (event published from MSMQ, handler inside AzureServiceBus endpoint)
NServiceBus doesn’t automatically unsubscribe so removing the config from the bridge would just mean that the subscription isn’t set up if missing.
You can find the POC code zip file below. The code depends on two environment variables for Azure Service Bus(AzureServiceBus_ConnectionString) and Azure Table Storage (AzureTableStorage_ConnectionString). You should be able to reproduce the issue if you select the following projects to start:
I can reproduce the issue with the code you sent, it seems like there is a problem with the AzureTableStorage outbox implementation since if I switch to NonDurable persistence everything seems to work as expected.
I’ll keep digging and let you know when I find the root cause.