To use Azure Service Bus as the underlying transport:
var transport = new AzureServiceBusTransport("Endpoint=sb://[NAMESPACE].servicebus.windows.net/;SharedAccessKeyName=[KEYNAME];SharedAccessKey=[KEY]"); endpointConfiguration.UseTransport(transport);
These settings control how the transport connects to the broker.
UseWebSockets(): Configures the transport to use AMQP over websockets.
TimeToWaitBeforeTriggeringCircuitBreaker(TimeSpan): The time to wait before triggering the circuit breaker after a critical error occurred. Defaults to 2 minutes.
CustomRetryPolicy(RetryPolicy): Allows replacement of the default retry policy.
CustomTokenCredential(TokenCredential): Enables using Azure Active Directory (AAD) authentication such as managed identities for Azure resources instead of the shared secret in the connection string.
<asb-namespace-name>.servicebus.windows.net) instead of a connection string (e.g.
These settings control how the transport creates entities in the Azure Service Bus namespace.
TopicName(string): The name of the topic used to publish events between endpoints. This topic is shared by all endpoints, so ensure all endpoints configure the same topic name. Defaults to
bundle-1. Topic names must adhere to the limits outlined in the Microsoft documentation on topic creation.
EntityMaximumSize(int): The maximum entity size in GB. The value must correspond to a valid value for the namespace type. Defaults to 5. See the Microsoft documentation on quotas and limits for valid values.
EnablePartitioning(): Partitioned entities offer higher availability, reliability, and throughput over conventional non-partitioned queues and topics. For more information about partitioned entities see the Microsoft documentation on partitioned messaging entities.
SubscriptionNamingConvention(Func: By default subscription names are derived from the endpoint name. This callback allows for a replacement name for the subscription. Subscription names must adhere to the limits outlined in the Microsoft documentation on subscription creation.
SubscriptionNameShortener(Func: Shortens subscription names that exceed the maximum length. The shortener is invoked only when a subscription name exceeds the maximum length.
SubscriptionRuleNamingConvention(Func: By default rule names are derived from the message type's full name. This callback allows for a replacement name for the rule. Rule names must adhere to the limits outlined in Service Bus quotas.
RuleNameShortener(Func: Shortens rule names that exceed the maximum length. The shortener is invoked only when a rule name exceeds the maximum length.
When both a shortener and a naming convention are provided for a subscription or subscription rule, the naming convention is applied first, and the result is then passed into the shortener.
When consuming messages from the broker, throughput can be improved by having the consumer prefetch additional messages. The prefetch count is calculated by multiplying maximum concurrency by the prefetch multiplier. The default value of the multiplier is 10, but it can be changed by using the following:
transport.PrefetchMultiplier = 3;
Alternatively, the whole calculation can be overridden by setting the prefetch count directly using the following:
transport.PrefetchCount = 100;
To disable prefetching, prefetch count should be set to zero.