Skip to content

FAQ: Publishers And Subscribers

Do I Need To Start A Subscriber?

Yes.

Subscribers implement:

IAsyncRunnable

and must be started explicitly.

await subscriber.Start();

How Do I Stop A Subscriber?

Use:

await subscriber.Stop();

How Can I Check Whether A Subscriber Is Running?

Use:

subscriber.IsRunning

Can Multiple Subscribers Consume The Same Queue?

Yes.

RabbitMQ distributes messages across consumers attached to the same queue.

Queue
 ├─ Subscriber A
 ├─ Subscriber B
 └─ Subscriber C

This is commonly used for horizontal scaling.


Can Multiple Publishers Publish To The Same Exchange?

Yes.

Multiple publishers can publish messages to the same exchange.

Publisher A
Publisher B
Publisher C
       ↓
    Exchange

Why Is My Subscriber Not Receiving Messages?

Verify:

  • the subscriber has been started;
  • the queue exists;
  • the exchange exists;
  • bindings exist;
  • routing keys match;
  • the publisher uses the expected exchange.

Can A Publisher Create RabbitMQ Topology?

Yes.

Publishers can create exchanges and related topology during initialization.

Subscribers can create queue-related topology.


Must Publisher And Subscriber Use The Same Descriptor?

No.

However, they must describe compatible RabbitMQ topology.

For example:

Publisher:

Exchange: orders
Routing Key: orders.created

Subscriber:

Exchange: orders
Queue: orders.created
Routing Key: orders.created

Can I Use More Than One Formatter?

Yes.

However, publisher and subscriber must remain compatible regarding payload format.

Using the same formatter implementation is generally recommended.


Are Publisher And Subscriber Thread Safe?

This depends on the implementation and lifecycle management strategy.

In most applications, publisher and subscriber instances are created once and reused throughout the application lifetime.