Publishers name configuration

This page refers to the legacy Azure Service Bus transport, which is rendered obsolete by the Azure Service Bus transport built to target both .NET Framework and .NET Core. All new projects should use the new Azure Service Bus transport.

When the EndpointOrientedTopology is selected, a mapping between publisher names and event types has to be properly configured, in order to ensure that subscriber can receive event messages.

The mapping can be configured for a specific event type:

var transport = endpointConfiguration.UseTransport<AzureServiceBusTransport>();
var topology = transport.UseEndpointOrientedTopology();
topology.RegisterPublisher(typeof(MyMessage), "publisherName");

or for an assembly containing multiple event types:

var transport = endpointConfiguration.UseTransport<AzureServiceBusTransport>();
var topology = transport.UseEndpointOrientedTopology();
var messagesAssembly = Assembly.LoadFrom("path/to/assembly/containing/messages");
topology.RegisterPublisher(messagesAssembly, "publisherName");

In the latter case, the transport analyzes all types in the assembly to identify which are events, using the IEvent interface or the configured DefiningEventsAs() message convention. Then for each event type, the transport registers a mapping between the type and the publisher name.

In the snippets the publisherName is the name of the endpoint that will publish messages.


Last modified