.net – MSMQ: Acknowledgments not returned when delivering to a remote queue

.netmsmq

I have the following scrap of code to test MSMQ acknowledgments:

    static void Main(string[] args)
    {
        string queuePath = args[0];
        string ackQueuePath = args[1];
        MessageQueue queue = new MessageQueue(queuePath);
        MessageQueue ackQueue = new MessageQueue(ackQueuePath);
        Message message = new Message("Body text");
        message.Label = "test";
        message.Recoverable = true;
        message.TimeToReachQueue = new TimeSpan(0, 1, 0);
        message.TimeToBeReceived = new TimeSpan(1, 0, 0);
        message.AdministrationQueue = ackQueue;
        message.AcknowledgeType = AcknowledgeTypes.FullReachQueue;
        queue.Send(message, MessageQueueTransactionType.Single);
    }

If both queuePath and ackQueuePath are local, i.e. ".\private$\queuename" format, I get the "test" message in the main queue and a reach-queue acknowledgement in the admin queue as expected. However, if queuePath points to a remote queue, i.e. "FormatName:DIRECT=OS:MACHINENAME\private$\queuename" format, I get the "test" message in that remote queue, but no reach-queue acknowledgment in the local admin queue.

I haven't seen anything indicating that acknowledgments cannot be returned from remote queues, so I presume there is a problem with my code or my environment. Any ideas?

(Both machines are Windows 2003.)

Best Solution

@LievenCardoen & @marijne.

Not sure if this was your original problem but the acknowledgement queue should not be transactional. If it is you will not receive any acknowledgement messages and there is no error message of any sort that will indicate this to you. I've had to learn this the hard way :)

Cheers Johan

Related Question