Azure Service Bus PartitionKey Convention

The PartitionKey on published/sent messages can be configured by convention, allowing the same method to be used for messages which implement a common interface type. If no common type is shared, each message type may be configured individually using various conventional selectors. Alternatively, developers may create their own convention to fit their needs.

When configuring a bus, the send topology can be used to specify a routing key formatter for a particular message type.

public interface SubmitOrder
{
    string CustomerId { get; }
    Guid TransactionId { get; }
    // ...
}

Bus.Factory.CreateUsingAzureServiceBus(..., cfg =>
{
    cfg.Send<SubmitOrder>(x =>
    {
        x.UsePartitionKeyFormatter(context => context.Message.CustomerId);
    });
});

results matching ""

    No results matching ""