MSMQ messages ending up in the "Transactional dead-letter messages" System Queue

I've been working with a solution recently that uses MSMQ to, well, pass messages between components running on different machines. It's been implemented using WCF as the abstraction layer, so instead of code like this:

MessageQueue messageQueue = new MessageQueue(@".\Private$\rwtest");
messageQueue.Send("My message");

We've got code that looks a little bit like this:

var endpointAddress = "net.msmq://localhost/private/atestqueue";

var channelFactory = new ChannelFactory(
    new NetMsmqBinding(NetMsmqSecurityMode.None),
    new EndpointAddress(endpointAddress));

var channel = channelFactory.CreateChannel(new EndpointAddress(endpointAddress)); channel.SendMessage("Hello, world!");

(This is almost certainly more long-winded than is strictly necessary, but I've extracted it from the actual code to help me shake out a mis-configuration somewhere, which means that the channel factory, channel, etc,.. are all constructed by a DI framework, the endpoint address is constructed from configuration settings, and so on)

The problem I was seeing is that every message that's created by the call to SendMessage ends up in the "Transactiondal dead-letter messages" System Queue:

The messages that ended up in the Transactional dead-letter messages System Queue

It turns out (and for whatever reason, this was something I struggled to easily determine the answer to!) the Class of "Nontransactional queue" on each of the messages means that the code is attempting to send messages to a Transactional Queue, however the queue itself has been configured to be Nontransactional. Rather than this resulting in an exception being thrown, the message is accepted but then falls through into the Transactional dead-letter message queue. Here's the mis-configured queue:

Queue properties showing that the queue has been configured as a 'Nontransactional queue'

It's not possible (or at least doesn't appear to be possible) to change the Transactional/Non-transactional nature of a Message Queue, so the solution was to delete and re-create the queue.

About Rob

I've been interested in computing since the day my Dad purchased his first business PC (an Amstrad PC 1640 for anyone interested) which introduced me to MS-DOS batch programming and BASIC.

My skillset has matured somewhat since then, which you'll probably see from the posts here. You can read a bit more about me on the about page of the site, or check out some of the other posts on my areas of interest.

No Comments