4
votes

There is a remote machine (let's call it MSMQ machine) which has MSMQ installed on it and is used by several other processes. I would like to read the messages on a given private queue of the MSMQ machine from my local machine - BUT, I would like to avoid installing Message Queuing on my machine, since what I need is simply to check and monitor the messages. I will not send nor receive messages (at least won't store them), I just want to "peek" at them.

Is there any way to do this? I have a code more a less like this now:

public string CheckMessageQueue(machine, queue)
{
    StringBuilder Ret = new StringBuilder();
    var path = machine "\Private$\" + queue;
    try
    {
        MessageQueue mq = new MessageQueue(path);
        Message msg = new Message();
        msg = mq.Peek();
        Console.WriteLine(msg.ToString());
    }
    catch (Exception e)
    {
        Console.WriteLine(e.Message);
    }
}

if I run the code above I get the error message

"Message Queuing has not been installed on this computer."

1
Another option may be to create some endpoint on the target (MSMQ) machine using, say, web-api and then access that from the client.Eben Roux

1 Answers

2
votes

No, there is no other way than installing MSMQ on your local machine as well. The client libraries uses the local server to communicate with remote servers.