Azure Storage Queues Transport Upgrade Version 9 to 10

Cross Account Routing

Sending a message

To send a message to a receiver on another storage account, the configuration

var transportConfig = configuration.UseTransport<AzureStorageQueueTransport>();
var routing = transportConfig
                    .ConnectionString("connectionString")
                    .AccountRouting();
var anotherAccount = routing.AddAccount("AnotherAccountName", "anotherConnectionString");
anotherAccount.RegisteredEndpoints.Add("Receiver");

transportConfig.Routing().RouteToEndpoint(typeof(MyMessage), "Receiver");

becomes:

var transportConfig = configuration.UseTransport<AzureStorageQueueTransport>();

var routing = transportConfig
                    .ConnectionString("connectionString")
                    .AccountRouting();
var anotherAccount = routing.AddAccount("AnotherAccountName", "anotherConnectionString");
anotherAccount.AddEndpoint("Receiver");

transportConfig.Routing().RouteToEndpoint(typeof(MyMessage), "Receiver");

Subscribing on an event

To subscribe to an event, coming from a publisher on another storage account, the configuration

var transportConfig = configuration.UseTransport<AzureStorageQueueTransport>();
transportConfig.DefaultAccountAlias("subscriber");
var routing = transportConfig
                    .ConnectionString("connectionString")
                    .AccountRouting();
var anotherAccount = routing.AddAccount("PublisherAccountName", "anotherConnectionString");
anotherAccount.RegisteredEndpoints.Add("Publisher");

transportConfig.Routing().RegisterPublisher(typeof(MyEvent), "Publisher");

becomes:

var transportConfig = configuration.UseTransport<AzureStorageQueueTransport>();
transportConfig.DefaultAccountAlias("subscriber");
var routing = transportConfig
                    .ConnectionString("connectionString")
                    .AccountRouting();
var anotherAccount = routing.AddAccount("publisher", "anotherConnectionString");
anotherAccount.AddEndpoint("Publisher1", new[] { typeof(MyEvent) }, "optionalSubscriptionTableName");

Publishing an event

To publish an event to a subscriber in another storage account, the configuration

var transportConfig = configuration.UseTransport<AzureStorageQueueTransport>();
transportConfig.DefaultAccountAlias("publisher");
var routing = transportConfig
                    .ConnectionString("anotherConnectionString")
                    .AccountRouting();
var anotherAccount = routing.AddAccount("subscriber", "connectionString");
anotherAccount.RegisteredEndpoints.Add("Subscriber1");

becomes:

var transportConfig = configuration.UseTransport<AzureStorageQueueTransport>();
transportConfig.DefaultAccountAlias("publisher");
var routing = transportConfig
                    .ConnectionString("anotherConnectionString")
                    .AccountRouting();
var anotherAccount = routing.AddAccount("subscriber", "connectionString");
anotherAccount.AddEndpoint("Subscriber1");

Related Articles


Last modified