Proper way to use NServiceBus.Storage.MongoDB with NServiceBus.Router

I am trying to setup an NServiceBus.Router endpoint to faciliate communication between an Azure Service Bus endpoint and an SQS endpoint. When I try to enable message driven pub/sub on the sqs interface router configuration, it wants an ISubscriptionStorage, but I do not see how to get a reference to that in the official NServiceBus MongoDB package.

Here’s a sample snippet:

var routerConfig = new RouterConfiguration(endpointName);

var sqsInterface = routerConfig.AddInterface<SqsTransport>("SQS", t =>
{
    t.ClientFactory(() =>
        new AmazonSQSClient(
            new BasicAWSCredentials(AppConfiguration.Instance.AccessKey, AppConfiguration.Instance.AccessSecret),
            RegionEndpoint.GetBySystemName(AppConfiguration.Instance.AwsRegion)));
});


var mongoDatabase = ...;

sqsInterface.EnableMessageDrivenPublishSubscribe(new SubscriptionPersister(mongoDatabase));

Hi @biddlem

Unfortunately the Router does not have a MongoDB subscription storage. It uses the same ISubscriptionStorage interface as NServiceBus, but has its own implementations of it. The reason is NServiceBus persistence implementations cannot be used outside of a regular NServiceBus endpoint due to visibility restrictions on some of the implementation classes.

Currently the only implementation of ISubscriptionStorage available for the Router is based on SQL. It supports all popular dialects of SQL so you should be able to use a hosted MySQL clone on AWS.

I am sorry for the inconvenience. Router is my “side” project, not product of Particular so it is not aligned with the release cycle of official products (such as MongoDB persistence). I don’t plan to add MongoDB persistence to the router due to my limited capacity as an OSS developer.

Szymon