tags:

views:

39

answers:

1

Hi,

I'm trying to make a queue be listened by two different applications but, so far, I didn't succeed on that.

I have tried both BeginPeek and BeginReceive methods but none of them worked. If I use BeginReceive along with ReceiveCompleted event only one server receives the message. If I use BeginPeek along with PeekCompleted the system runs into a loop or, if I manage to remove the message from the queue, only one server receives it.

Any clue of how to accomplish that???

Thanks

A: 

The normal queue methods won't work for your case because, well, it's a queue, so first in first out. You have a few options.

The first option is to have the server publish onto two different queues, one for each client application. Then each client would use the BeginReceive/ReceiveCompleted methods. This is quite simple, but it can be a problem if you want to scale to many client applications. This is what I've done when I had several downstream systems that I needed to send messages to.

This MSDN blog suggests that you can attach a PGM multicast address to your queue. The clients then subscribe to the multicast group and receive the messages that way. I don't have any experience with this, but it looks like you lose transactionality, which may be a problem.

dsolimano