Search code examples
.netmsmqeai

Is there an equivalent function like JMS Topic in MSMQ?


In JMS topics are a core concept. It is the representation of the publish/subscribe pattern.

  1. The publisher publishes his messages on a channel
  2. The subscribers subscribe to that channel and receive messages from that channel
  3. The channel removes the message when every subscriber got the message

Is there a similar function in MSMQ/.NET?

Note: The publisher should not care about how many or which subscriber there are.


Solution

  • MSMQ does not have direct concept of topics. In normal operation, one message is delivered to only one receiver - once it is read from queue it become unavailable to any other receiver trying to read from the same queue. MSMQ has a concept of triggers which is somehow trying to overcome this limitation by delivering message to multiple receivers but it is definitely not the same (and not as easy to use) as topics.

    If your use case really requires topics you will either have to create your own multicast "server" communicating with subscribers and publishers over MSMQ or you will need to choose more suitable technology - for example ServiceBus for Windows, Rabbit MQ, Active MQ, etc.