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.

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.

  • 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 0: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 0: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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.