Skip to content
Mogens Heller Grabe edited this page Jul 11, 2019 · 4 revisions

Routing

RabbitMQ has native support for topic-based messaging, and Rebus will use that capability to implement pub/sub.

Therefore, the following configuration is enough for two Rebus instances to be able to communicate:

var subscriber = Configure.With(...)
	.Transport(t = t.UseRabbitMq(connectionString, "my-subscriber"))
	.Start();

var publisher = Configure.With(...)
	.Transport(t = t.UseRabbitMq(connectionString, "my-publisher"))
	.Start();

after which you may go

await subscriber.Subscribe<MyEvent>();

and then the subscriber will be subscribed to everything the publisher publishes like so:

await publisher.Publish(new MyEvent(...));

Clone this wiki locally