Publishers name configuration

Component: Azure Service Bus Transport
NuGet NServiceBus.Azure.Transports.WindowsAzureServiceBus (8-pre)
Target NServiceBus Version: 6.x
This page targets a pre-release version and is subject to change prior to the final release.

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 marker interface IEvent 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