Skip to content
On this page

Broadcast Messages to a Specific Topic

If you're using a transport endpoint that supports publishing messages by topic such as this example using Rabbit MQ from the Wolverine tests:

cs
theSender = Host.CreateDefaultBuilder()
    .UseWolverine(opts =>
    {
        opts.UseRabbitMq("host=localhost;port=5672").AutoProvision();
        opts.PublishAllMessages().ToRabbitTopics("wolverine.topics", exchange =>
        {
            exchange.BindTopic("color.green").ToQueue("green");
            exchange.BindTopic("color.blue").ToQueue("blue");
            exchange.BindTopic("color.*").ToQueue("all");
        });
    }).Start();

snippet source | anchor

You can explicitly publish a message to a topic through this syntax:

cs
var publisher = theSender.Services
    .GetRequiredService<IMessageBus>();

await publisher.BroadcastToTopicAsync("color.purple", new Message1());

snippet source | anchor

Scheduling Message Delivery

TODO -- write stuff here

Released under the MIT License.