Mattox.NServiceBus endpoints can be configured through the Microsoft.Extensions.Configuration
. All settings are defined in the NServiceBus:EndpointConfiguration
section. Different endpoints supporting different transport may define additional settings. Refer to the endpoint-specific documentation for more details.
Root section: NServiceBus:EndpointConfiguration
.
EndpointName
configures the endpoint name. This setting is mandatory unless specified through the endpoint class constructor.
SendOnly
(True
/False
, defaults toFalse
) configures the endpoint as a send only endpoint.
Section full name: NServiceBus:EndpointConfiguration:Installers
Enable
(True
/False
, defaults toFalse
) enables the endpoint installers.
Section full name: NServiceBus:EndpointConfiguration:Diagnostics
Enable
(True
/False
, defaults toTrue
) enables the endpoint startup diagnostics.
Section full name: NServiceBus:EndpointConfiguration:Auditing
The Auditing
section allows controlling the endpoint audit capability.
Enabled
(True
/False
, defaults toTrue
) allows enabling or disabling the endpoint auditing functionalities. By default, NServiceBoXes endpoints have auditing enabled.AuditQueue
defines the audit queue name; if omitted, a default value ofaudit
is used.
Section full name: NServiceBus:EndpointConfiguration:Recoverability
The Recoverability
section allows controlling the endpoint recoverability capability.
ErrorQueue
defines the error queue name; if omitted, a default value oferror
is used.
Section full name: NServiceBus:EndpointConfiguration:Recoverability:Immediate
The Recoverability Immediate
sub-section allows controlling immediate retry settings:
NumberOfRetries
defines the number of times a failing message is retried immediately without delay.
Section full name: NServiceBus:EndpointConfiguration:Recoverability:Delayed
The Delayed
sub-section allows controlling delayed retry settings:
NumberOfRetries
defines the number of times a failing message is retried in a delayed fashion.TimeIncrease
(format:TimeStamp
) defines how much delay is used between delayed retries
Section full name: NServiceBus:EndpointConfiguration:Recoverability:AutomaticRateLimiting
The AutomaticRateLimiting
section allows configuring the endpoint automatic rate limiting feature.
ConsecutiveFailures
defines the number of failure that trigger the rate limiting featureTimeToWaitBetweenThrottledAttempts
(optional, format:TimeSpan
, defaults to 1 second) defines the time to wait between throttled attempts.
It's also possible to define code callbacks that will be triggered when rate limiting starts and ends:
endpoint.Recoverability.OnRateLimitStarted(token => Task.CompletedTask);
endpoint.Recoverability.OnRateLimitEnded(token => Task.CompletedTask);
To intercept and customize failed messages before they are sent to the configured error queue, use the following code:
endpoint.Recoverability.OnFailedMessage(settings =>
{
settings.HeaderCustomization(headers =>
{
// Customize failed message headers
});
});
To take full control over how the endpoint treats failed message, it's possible to register a custom recoverability policy:
endpoint.Recoverability.UseCustomRecoverabilityPolicy(((config, context) =>
{
// Use the configuration and the context
// to decide how to handle the failing message
return RecoverabilityAction.ImmediateRetry();
}));
Section full name: NServiceBus:EndpointConfiguration
LocalAddressOverride
(string) allows defining the address to override the default one that matches the endpoint name.PublicReturnAddressOverride
(string) allows overriding the endpoint return/reply address used by other endpoint when replying to messages.EndpointInstanceDiscriminator
(string) allows making endpoint instances in scaled out environments uniquely addressable.
Section full name: NServiceBus:EndpointConfiguration:Transport
NOTE: It's suggested to not discard messages in production.
PurgeOnStartup
(True
/False
, defaults toFalse
) configures the endpoint to discard input queue messages a startup and start fresh.
TransportTransactionMode
(TransactionScope, SendsAtomicWithReceive, ReceiveOnly, None. The default value depends on the transport of choice) allows defining the endpoint message processing transaction guarantees.
MessageProcessingConcurrency
(int
, defaults to not set) sets the endpoint concurrency level that determines how many messages the endpoint processes in parallel.