0
votes

I'm working with Azure ServiceBus, standard tier.

I'm trying to figure out what's happened since a couple of weeks, (it seems it started when bus traffic has increased, maybe 10-15 messages per second).

I have automatic creation of subscription using

subscriptionOpts.AutoDeleteOnIdle = TimeSpan.FromHours(3);

Starting from lasts weeks, (when we got a traffic increment), sometimes our subscriptionclients stopped receiving messages and after 3 hours they get deleted.

var messageOptions = new MessageHandlerOptions(args =>
    {
         Emaillog.Warn(args.Exception, $"Client ExceptionReceived: {args.Exception}");
         return Task.CompletedTask;
    }) { AutoComplete = true };
_subscriptionClient.RegisterMessageHandler(async (message, token) => await OnMessageReceived(message, $"{_subscriptionClient.SubscriptionName}", token), messageOptions);

Is it possible that a subscription client gets disconnected and doesn't connect anymore? I have 4-5 clients processes that connect to this topic, each one with his own subscription. When I find one of these subscriptions deleted, sometimes they have all been deleted, sometimes only some of them have been deleted.

Is it a bug? The only method call I do on the subscriptionClient is RegisterMessageHandler. I don't manage manually anything else...

Thank you in advance

1
If there's no sending/receiving clients there will be no changes in messages on the broker. The broker will consider that entity idle and eventually remove that entity. @nemenos could you confirm that while apps are running there is or there's no change in message counts? - Sean Feldman
now I raised from 3 hours to 3 days, so I can debug it better and check. until now I could only find it after 3 hours, with subscription already deleted. But I'm sure that many messages were sent to the topic in the meanwhile (we have gps system connected sending positions) - nemenos
Ok, connection lost, and message still growing. No more messages received. a bug of dotnet library? ... - nemenos
As long as messages are sent in, the entity will be considered active. - Sean Feldman
"messages sent in" sent to queue or topic. From topic they are getting into subs 😉. Would be a too significant bug not to work. Cheers. - Sean Feldman

1 Answers

0
votes

The property AutoDeleteOnIdle is used to delete the Subscription when there is no message processing with in the Subscription for the specified time span.

As you mentioned that the message flow increased to 15 messages per second, there is no chance that the Subscription is left empty (with out message flow). So there is no reason for the Subscriptions to delete. The idleness of the Subscription is decided by both incoming and outgoing messages.

There can be chances that due to heavy message traffic, the downstream application processing the messages may went offline, leaving the messages unprocessed, eventually when the message flow reduced there is no receiver to process the messages, leaving the Subscription idle for 3 hours and delete.