MSMQ Send message to Remote Queue
Asked Answered
L

1

9

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.

Laflamme answered 17/1, 2012 at 19:20 Comment(0)
M
16

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?

Mezzosoprano answered 17/1, 2012 at 19:48 Comment(10)
Thanks @hugh....took a look at the event log...didn't see anything so far. Will take a look at permissionsLaflamme
thank you it was the Send / Receive perms on that queue! I greatly appreciate it.Laflamme
Hi Hugh...yeah i had changed to using Private$....was just trying to rule everything out when I was testingLaflamme
Sorry about that...thought I did. Should work fine for WCF too right? So if I am using the MsmqIntegrationBinding?Laflamme
Yes. Although with MsmqIntegrationBinding the type received in your handler method has to be of type MsmqMessage. If you want to have a proper typed datacontract you should use netMsmqBinding. However this is only if you have wcf on both ends.Mezzosoprano
You won't see anything in the event log as that only shows REAL problems - for a messaging system, losing messages can be regarded as normal.Hailey
Negative Source Journaling is the best way to troubleshoot this sort of problem as the message in the Dead Letter Queue explains the cause of the problem.Hailey
Thanks @JohnBreakwell I appreciate that. I will look at that. Still can't get the WCF msmq write to remote queue to workLaflamme
@Kiquenet you should probably post a separate question for this.Mezzosoprano
On windows 2008 I have to set the permissions to ANONYMOUS LOGON for Send/Receive and I have to add a firewall entry rule on port 3527 protocol UDP. Thank you for the guideAkmolinsk

© 2022 - 2024 — McMap. All rights reserved.