Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSMQ Send message to Remote Queue

Tags:

c#

msmq

I am trying to send a message to a remote queue. My process isn't failing, but I still don't see the message on the remote queue? I would assume it would fail if it couldn't process the message?

I did notice that on my local machine the remote queue is listed in Outgoing queues, but don't see messages there either. Very ignorant here and all examples show that how I am doing (or so I assume) is correct.

Code (Simple for test):

    using (var transaction = new TransactionScope())
    {
        using (var queue = new MessageQueue(@"FormatName:DIRECT=OS:mymachine\MyQueueQueue"))
        {
            XDocument xdoc = XDocument.Parse("<root/>");

                 var message = new Message(xdoc.ToString());
                queue.Send(message, MessageQueueTransactionType.Single);
        }

        transaction.Complete();
    }

    Console.Read();
}

What I am doing wrong? Strange...no errors, but don't see message anywhere. Write works to my local queue.

like image 779
scarpacci Avatar asked Jan 17 '12 19:01

scarpacci


People also ask

How do I send a message to MSMQ?

To send a message to MSMQ, create an instance of the MessageQueue class and call the Send method that passes in the Message object. The MessageQueue class is the wrapper that manages the interaction with MSMQ. The syntax for setting the path of the private queue that you created in the Computer Management console.

Is MSMQ dead?

For all practical purposes, MSMQ is dead. Design interoperable systems: Get FREE access to Udi Dahan's Distributed Systems Design Fundamentals video course for a limited time. The real cause of MSMQ's demise is . NET Core.

How does MSMQ queue work?

Message Queuing (MSMQ) technology enables applications running at different times to communicate across heterogeneous networks and systems that may be temporarily offline. Applications send messages to queues and read messages from queues.

How do I create a public queue in MSMQ?

To create a new queue, right click on the desired queue folder (Public Queues or Private Queues) and select New > Public/Private Queue. In the New Public/Private Queue dialog, enter the name of the queue in the Queue name text field. Click OK to confirm.


1 Answers

The queue you see on your local machine is how MSMQ transmits a message from your machine to the remote machine. So don't worry about that as long as there are no messages on it. If there were messages on it that would indicate the remote queue was not available for some reason.

Likely permissions could an issue. Check the send permissions on the remote queue. If the call is going cross-domain you will need to add ANONYMOUS LOGON to your permissions.

Also try to enable to MSMQ event log (if you are running server 2008 or above).

UPDATE

It looks like you are calling a public queue address. You should be using private queues. The address is the same except for the PRIVATE$ directive:

FormatName:DIRECT=OS:mymachine\PRIVATE$\MyQueueQueue

ALSO: is your queue name myQueueQueue like in your queue address?

like image 148
tom redfern Avatar answered Oct 26 '22 12:10

tom redfern