MSMQ Subscription Persistence usage

Component: MSMQ Persistence
NuGet Package: NServiceBus.Transport.Msmq (2-pre)
This page targets a pre-release version. Pre-releases are subject to change and samples are not guaranteed to be fully functional.

This sample shows basic usage of MSMQ as storage for subscriptions.

Prerequisites

Ensure that MSMQ has been installed.

Code walk-through

The application publishes an empty event to itself and writes to the console when the event is received.

Configuration

endpointConfiguration.UsePersistence<MsmqPersistence, StorageType.Subscriptions>();
// disable delayed retries as MSMQ doesn't support timeouts natively:
endpointConfiguration.Recoverability().Delayed(settings => settings.NumberOfRetries(0));
MSMQ Persistence only supports subscription storage so another storage is needed for Timeouts since MSMQ doesn't have native timeout support.

Related Articles


Last modified