0

I have a setup where I have a chain of servers that I need to send messages between:

A -> B

On A I have an application which puts a message on a local MSMQ queue. This queue needs to forward the message to a MSMQ queue on B.

The messages do not need to be transactional.

I've enabled HTTP support under the Windows Message Queuing feature. I've added a mapping file under the System32/msmq/mappings folder looking like this:

<redirections xmlns="msmq-queue-redirections.xml">
   <redirection> 
     <from>http://A/msmsq/private$/logger</from>
     <to>http://B/msmq/private$/logger</to>
   </redirection>
</redirections> 

I am using powershell to send the messages to the queue on A like this:

Get-MsmqQueue -name logger | Send-MsmqQueue -body "test message" -label "test"

When the messages are placed on the queue on A they are not redirected to B, they stay on the A queue.

How should I configure A and B so that messages are forwarded from the MSMQ on A to the MSMQ on B?

UPDATE

In the real scenario there are more servers involved in the chain and each server is only allowed to communicate with the next server in the chain. At the last server in the chain an application reads from the queue on that server and inserts the messages into a DB.

pac w
  • 101
  • 1

1 Answers1

0

You cannot do it the way you are trying. When you send a message to local queue A, that's it. The message has been successfully delivered. Job done.

MSMQ uses outgoing queues to provide the functionality you're after.

Use PowerShell to send the message directly to server B. The message is stored in the outgoing queue on A until it can be delivered to B. Store-and-forward in action.

John Breakwell
  • 757
  • 5
  • 11
  • I am not sure I follow you. If I send a message directly to B don't I bypass the queue on A completely? How can the message be stored in any queue on A if I don't put the message on A? – pac w Nov 13 '15 at 19:58
  • What is the purpose of the local queue on A that you are putting a message into? Is it purely as a step to moving it to B? If it is then don't bother. Send the message directly to B. – John Breakwell Nov 15 '15 at 00:02
  • If you put the message into the local queue on A so some application can use it in some way then that's a different matter. For example, you could have a system of multiple apps; one puts message in queue on A; second app peeks the message for some data; third app needs the message in queue on B so it can receive it. If that's the case, you still can't use redirection or forwarding. – John Breakwell Nov 15 '15 at 00:05
  • The system described is a simplification of a real world system where there are multiple servers between A and B which all have to redirect to the end server B. On B there is an application which picks up the messages and insert them into a DB. Each server is only allowed to communicate with the next server in the chain. So.. is there something wrong with my redirection XML or should I look for something else on the server which is blocking the communication? – pac w Nov 16 '15 at 12:16
  • The redirection file can't work as you're looking at moving a file from one queue to another. Redirection doesn't work like that. It works like how the snail mail post office redirects your mail. You send a letter to the destination that you are aware of. The postman in the sorting office has a Post-It on the pigeonhole that tells them where the new destination is. The letter then gets redirected to the appropriate sorting office. If there is another Post-It for that new address, the letter keeps travelling. Importantly, it never gets delivered until the very end. – John Breakwell Nov 16 '15 at 12:49
  • So you will have multiple redirection files, each different. A sends message to a queue on B (NOT a queue on A). The redirection file on B maps the queue on B to a queue on C. B sends the message to the queue on C. The redirection file on C maps the queue on C to a queue on D. And so on. The source and destination servers have no redirection file, only the servers in between. – John Breakwell Nov 16 '15 at 12:52
  • But that's if you are sending MSMQ messages over HTTP. You can send MSMQ messages using the native MSMQ protocol (instead of HTTP) and employ MSMQ Routing but that involves an Active Directory domain structure and an enterprise admin to set up the routes through the system. I'm assuming you don't have that. – John Breakwell Nov 16 '15 at 12:57