MSMQ Subscription Authorization

Component: MSMQ Transport
NuGet Package NServiceBus (4.x)
Standard support for version 4.x of NServiceBus has expired. For more information see our Support Policy.

Subscription Authorization allows the programmatic control over what subscribers can subscribe of unsubscribe.

class AuthorizeSubscriptions :
    IAuthorizeSubscriptions
{

    public bool AuthorizeSubscribe(string messageType, string clientEndpoint, IDictionary<string, string> headers)
    {
        var lowerEndpointName = clientEndpoint.ToLowerInvariant();
        return lowerEndpointName.StartsWith("samples.pubsub.subscriber1") ||
               lowerEndpointName.StartsWith("samples.pubsub.subscriber2");
    }

    public bool AuthorizeUnsubscribe(string messageType, string clientEndpoint, IDictionary<string, string> headers)
    {
        return true;
    }
}

Samples

  • Publish/Subscribe
    Publish/Subscribe, fault-tolerant messaging, and durable subscriptions.

Last modified