MSMQ Subscription Persistence

Source
NuGet Package NServiceBus (4.x)
Standard support for version 4.x of NServiceBus has expired. For more information see our Support Policy.
The subscription queue can contain duplicate entries. This is by design and does not result in events being published multiple times. Subscriptrion entries are added for each subscription request received. After a publisher restarts, the subscription queue state will be rewritten and deduplicated.
Storing subscriptions in MSMQ must not be used when scaling out across multiple machines or running side-by-side on the same machine. The subscription queue cannot be shared among multiple endpoints instances for the same endpoint.

To configure MSMQ as the subscription persistence:

configure.MsmqSubscriptionStorage();

By default, NServiceBus uses a queue called {Name of endpoint}.Subscriptions. In order to specify a different queue to store the subscriptions, add the following configSections and subsequent config entry:

<configuration>
  <configSections>
    <section name="MsmqSubscriptionStorageConfig"
             type="NServiceBus.Config.MsmqSubscriptionStorageConfig, NServiceBus.Core" />
  </configSections>
  <MsmqSubscriptionStorageConfig Queue="YourEndpointName.Subscriptions" />
</configuration>

Samples


Last modified