Azure Service Bus topic subscriptions piling up

234 views
Skip to first unread message

Matthew Pearse

unread,
Sep 6, 2016, 3:56:03 AM9/6/16
to masstransit-discuss
Hello,

Happy to be back on the bus.  However coming across an issue, haven't raised in github as I'm presuming it is me :)

Each time we redeploy our app (cloud service based website / webjobs using the Azure Service Bus), I've noticed we seem to be getting extra subscriptions added for given a message contract in each topic.  The queues are fine.  Config is the same.

Relevant part of configuration looks like:

return MassTransit.Bus.Factory.CreateUsingAzureServiceBus(cfg =>
{
cfg.UseServiceBusMessageScheduler();
if (MaxNumberOfRetries > 0)
{
        var retryPolicy = new ExponentialRetryPolicy(new AllPolicyExceptionFilter(), MaxNumberOfRetries,
      TimeSpan.FromSeconds(MinimumIntervalForRetryInSeconds), TimeSpan.FromSeconds(MaximumIntervalForRetryInSeconds),
      TimeSpan.FromSeconds(IntervalDeltaForRetryInSeconds));
cfg.UseRetry(retryPolicy);
}

IServiceBusHost host = cfg.Host(SendEndpointUri, h =>
{
h.OperationTimeout = RequestTimeout;

h.SharedAccessSignature(s =>
{
s.KeyName = AzureKeyName;
s.SharedAccessKey = AzureKey;
s.TokenTimeToLive = AzureTokenTimeToLive;
s.TokenScope = TokenScope.Namespace;
});
});

cfg.ReceiveEndpoint(host, ec => { ec.LoadFrom(ctx);});


There is only one subscription the app is actually using (the one pointing to a queue in use, which is named like rd0003ff6f55ac_MYAPPNAME_endpoint_kssyyy89phyy8khrbdj7kcsonc).  The 'forward to' in the other subscriptions seem to point to long gone queues with different randomness in the naming.

Messages continue to be delivered to these subscriptions however, and messages pile up filling up the service bus to the point of breaking the topic Microsoft.ServiceBus.Messaging.QuotaExceededException: The maximum entity size has been reached or exceeded for Topic.... we were at 1GB).  In a test environment we got to the point where there were 63 subscriptions, and for every one event published 62 undeliverable messages sitting in the old subscriptions resulted, which quickly get dead lettered but hang about.

Should we be cleaning up these subscriptions ourselves on deployment, or is there something amiss with the configuration?

Thanks,
Matt

Matthew Pearse

unread,
Sep 13, 2016, 2:55:22 AM9/13/16
to masstransit-discuss
Ok I just found https://github.com/MassTransit/MassTransit/issues/553 .  Looks like this is the behaviour I am seeing.

Then I noticed I could explicitly set a queue name.  As in:
cfg.ReceiveEndpoint(host, AzureReceiveQueueName, ec => { ec.LoadFrom(ctx);});

So that is what we were missing.  Seeming these are persistent queues, suits me perfectly and seems to solve the issue as the subscriptions are to the queue name I have now specified rather than a generated name for the app (that changes each time I deploy).

Sorted :)
Reply all
Reply to author
Forward
0 new messages