Post by chrisis there a way to easily send them to a
remote server queue when they get received on the initial local machines
queue?
MSMQ doesn't really have any mechanism for moving messages from one
queue to another queue. MSMQ 4.0 introduced sub-queues which allow
programs to move messages from a queue to a sub-queue of that queue, but
that's not really what you are looking for.
If you are not already using positive acknowledgements for some other
purpose, you could use them to do roughly what you are looking to do.
Before you send the message, set PROPID_M_ACKNOWLEDGE to
MQMSG_ACKNOWLEDGMENT_FULL_RECEIVE and set the PROPID_M_ADMIN_QUEUE and
PROPID_M_ADMIN_QUEUE_LEN to point to the remote server queue. Now send
the message to the initial queue.
When the message is received from the initial queue a positive
acknowledgement message will be sent to the queue identified by the
PROPID_M_ADMIN_QUEUE property. That acknowledegement message will be a
copy of the original message with the Class property set to a value that
indicates that it is a positive acknowledgement.
The main drawbacks to this approach are
1) That the class property is overwritten, so if your application uses
the Class property you are in trouble.
2) That you'll also get negative acknowledgement messages - for example
if the Time To Be Received timer expires before the message is received
or if the queue is purged by an administrator - so the program
processing messages in the remote server queue needs to look for
negative acknowledgement messages and handle them appropriately.
3) That the original sending program cannot use the admin queue
mechanism or the acknowledgement mechanism because we've hijacked them
for this new use.