Publish / sign samples using RabbitMQ in .NET.

I created this sample: Getting started with RabbitMQ in .net , but made 2 programs:

  • one publisher
  • one subscriber

I use BasicPublish to publish and BasicAck to listen, as in the example. If I launch one publisher and several subscribers - on each "sending message" from the publisher - only one subscriber receives it. So there is some order (as subscribers started) in which the publisher sends messages to subscribers, and I want to send one message to all subscribers. What is wrong with this pattern? Maybe you can provide a working sample of publisher / subscribers messaging through RabbitMq?

+7
source share
3 answers

The example in which you are referring uses a simple queue without exchange, which ensures that only one consumer will process the message. To support pub / sub in RabbitMQ, you first need to create Exchange, and then each subscriber will bind a queue on this Exchange. The manufacturer then sends messages to Exchange, which will publish a message for each queue associated with it (at least with a simple type of Fanout exchange. Routing can be achieved by exchanging Direct and Topic.)

For a Java example (which can be easily converted to C #), see here .

Edit: An updated version of .Net can be found here.

+9
source

I added a new tutorial about this. Getting started with RabbitMQ in .net

+3
source

Currently, there are also official sources .

+1
source

All Articles