azureservicebus - Azure Service Bus topic: how enable concurrent readers? -
background
i'm using azure service bus. inside namespace, have topic active subscription. have producer pushing messages topic, , have n numbers of services subscribing the same subscription (for scalability reasons). these services using peeklock() fetch messages, performing work on them , releasing message lock through complete() once work has finished.
problem
whenever service has message locked, no new services seem able fetch messages same topic/subscription. seems if whole topic locked, not message has lock on itself.
the actual problem have services sitting around doing nothing waiting service active peeklock() finished.
questions
is there way enable concurrent readers (or concurrent locks) in topic (and subscription) or queue?
the (for me unwanted) scenario explain above - consequence of sort of guarantee deliver messages in order recieved?
code snippet: csharp
public static void main(...) { // configure options onmessageoptions messageoptions = new onmessageoptions(); messageoptions.autocomplete = false; // messages servicebusclient.onmessage(msg => processmessage(msg, connectionkey), messageoptions); } private static void processmessage(brokeredmessage msg, string connectionkey) { try { // stuff message //... // debugging: no new clients grab messages // while client has lock active. sleep // simulate heavy work load thread.sleep(5000); // release lock on message msg.complete(); } catch (exception e) { msg.abandon(); } }
do use recieve() or receieve(int64) method (or async variant) receieve message?
you have aware locks on message itself, not on subscription/queue. but, if use overload int64 , give big number - (lock) messages, , other processes not have do.
there no way lock subscription in azure service bus. limit of concurrent subscription receievers 5000!
here can read little more performance in service bus messaging.
next time ask question, please include code snippet able better understand issue!
Comments
Post a Comment