Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lock duration significance on azure service bus topic subscriptions

I have been looking at lockdurations and renewlock mechanisms for service bus queue and topics. However it is not clear about what exactly does lock duration mean for topic subscriptions.

For example:

If i have a topic GameScoreUpdate and it has multiple subscribers.

So any message to this topic will be delivered to all the subscribers.

now if On one subscription "Subscription1", i have a lock duration of 30 seconds. but message processing is not complete.then the lock expires?

What happens after this? the other subscribers have already been delivered this message. current subscriber is processing the message.

Whats the significance of lockduration in this case?

like image 456
Mandar Jogalekar Avatar asked Feb 01 '18 07:02

Mandar Jogalekar


People also ask

What is lock duration?

Functionality that allows you to change the pitches of existing music while retaining existing rhythms. Glossary.

What is peek lock in Service Bus?

When operating in the Service Bus Peek Lock mode, the client sends a request to receive a message from Azure Service Bus. Once the client receives the message, it will send a request to complete the message. There will be two individual steps in the peek lock mode.

Which of the following advanced features of Azure Service Bus is used to guarantee a first-in?

Message sessions To realize a first-in, first-out (FIFO) guarantee in Service Bus, use sessions. Message sessions enable joint and ordered handling of unbounded sequences of related messages.

Should ServiceBusClient be Singleton?

The Service Bus objects that interact with the service, such as ServiceBusClient, ServiceBusSender, ServiceBusReceiver, and ServiceBusProcessor, should be registered for dependency injection as singletons (or instantiated once and shared).


1 Answers

Think of each subscription as an "inbox". Each subscriber gets one. A message is sent to all subscribers, but realistically, it's a clone of the message that is placed into every "inbox", assuming it has a matching criteria.

When a given subscriber tries to process a message from an "inbox" using PeekLock mode, the message is marked as invisible. If there's a failure to process the message in LockDuration time, the message will re-appear in the "inbox" and will be attempted for processing again. Until MaxDeliveryCount attempts are exhausted. In that case, message will be dead-lettered.

This is really needed for competing consumers. I.e. when your subscriber (a process looking at a given subscription/"inbox") is scaled out for processing larger number of messages.

Whats the significance of lockduration in this case?

LockDuration instructs a queue (subscription is a queue after all) to keep message invisible from competing consumers to ensure current processing node can handle it withing time frame defined by LockDuration. Renew lock mechanism ensures that the lock on the currently being processed message is extended to allow longer than LockDuration processing time if needed so. Important thing to remember, lock renewal is not guaranteed to be successful.

like image 170
Sean Feldman Avatar answered Sep 21 '22 20:09

Sean Feldman