NServiceBus error queues in Azure

2019-06-07 18:10发布

问题:

I'm trying to setup NServiceBus in Azure. During local development I am using the storages queues and when deployed in the cloud I am using the Azure Service Bus. For some reason when an error occurs, messages are not moved to the error queue. In fact, the error queue isn't even created.

In my Web.config file I have the following configuration:

<MessageForwardingInCaseOfFaultConfig ErrorQueue="myApp-errors"/>

When configuring NServiceBus I call:

.MessageForwardingInCaseOfFault()

When a message fails, the last error in the log is always

Failed raising 'transport message received' event for message with ID=170ad256-b559-417e-8b34-3882045cc19e

Any thoughts on this? Messaging seems to work, it's just the error handling that doesn't work.

回答1:

My first guess is that the error queue can not be created as captials in the name are not allowed

If that doesn't work, we'll have to do a more thorough ananlysis, but that would require a little more information from the logs.

Hope this helps



回答2:

I was having this same problem with NServiceBus 3.3.

Here is what solved the problem for me. If the Azure queue isn't marked as transactional, then NServiceBus never even bothers to send the message to an error queue -- it just disappears into the ether.

Also, Second Level Retries do not work on Azure Queues -- you get a warning saying the queue needs to be on the same machine as the process.

So, if you don't disable SLR using either the .DisableSecondLevelRetries() or the app.config technique described here, NServiceBus will dump the messages into the retry queue instead of the error queue.

To get this working:

Disable Second Level Retries Make sure the Azure queues is configured to be transactional (even though they aren't in Azure)