Skip to content

Endpoint Specific Operations

You can also explicitly send any message to a named endpoint in the system. You might do this to programmatically distribute work in your system, or when you need to do more programmatic routing as to what downstream system should handle the outgoing message.

Regardless, that usage is shown below. Just note that you can give a name to any type of Wolverine endpoint:

using var host = await Host.CreateDefaultBuilder()
    .UseWolverine(opts =>


var bus = host.Services

// Explicitly send a message to a named endpoint
await bus.EndpointFor("One").SendAsync(new SomeMessage());

// Or invoke remotely
await bus.EndpointFor("One").InvokeAsync(new SomeMessage());

// Or request/reply
var answer = bus.EndpointFor("One")
    .InvokeAsync<Answer>(new Question());

snippet source | anchor

There's another option to reference a messaging endpoint by Uri as shown below:

// Or access operations on a specific endpoint using a Uri
await bus.EndpointFor(new Uri("rabbitmq://queue/rabbit-one"))
    .InvokeAsync(new SomeMessage());

snippet source | anchor

Released under the MIT License.