azure-sdk-for-java icon indicating copy to clipboard operation
azure-sdk-for-java copied to clipboard

How to Receive Bulk Messages from Azure Service bus

Open arbarik opened this issue 10 years ago • 2 comments

In my application all the events are getting stored in Azure service Bus queue, and another component reads that queue and process the events.We are using Azure-servicebus java sdk version 0.9.2.

After processing few thousand events we are getting below Service Bus error. Caused by: com.microsoft.windowsazure.exception.ServiceException: WRAP server returned error acquiring access_token Response Body: ACS90055: The server has terminated the request (tenant exceeded rate limit). Please wait a few seconds and try again.

Alert me | Edit | Change type Question You cannot vote on your own post 0 In my application all the events are getting stored in Azure service Bus queue, and another component reads that queue and process the events.We are using Azure-servicebus java sdk version 0.9.2.

After processing few thousand events we are getting below Service Bus error.

Caused by: com.microsoft.windowsazure.exception.ServiceException: WRAP server returned error acquiring access_token Response Body: ACS90055: The server has terminated the request (tenant exceeded rate limit). Please wait a few seconds and try again. It slows down my application. Also I am loosing lot of events.

How to get pass this error ?

How to fetch messages in a batch, Instead of fetching individual call for single message ?

Do we have Batch Receive support for Azure service bus Java SDK ? If no what other way we should follow for Java Application using Azure Service bus.

How to increase the rate limit for my tenant ?

I am using below code to receive all the messages from Queue: ` ServiceBusConfiguration.configureWithWrapAuthentication( ServiceBusName, ServiceBusAuthenticationName, ServiceBusSharedSecret, ServiceBusRootUri, ServiceBusWrapRootUri);

ReceiveMessageOptions options = new ReceiveMessageOptions();

options.setReceiveAndDelete();
ServiceBusContract service = ServiceBusService.create(serviceBusConfig);


ReceiveQueueMessageResult message =
    service.receiveQueueMessage(queueName, options);

   while( message.getValue() != null){

//Process the message . message = service.receiveQueueMessage(queueName, options);

   }`

arbarik avatar Apr 19 '16 19:04 arbarik

Hi,

You are hitting the WRAP server rate limit because there is a bug in token caching for DELETE message requests. I have created pull request which should fix the issue: https://github.com/Azure/azure-sdk-for-java/pull/666

It should also be possible to mitigate this issue by using SAS authentication instead of WRAP authentication.

As for bulk receive requests; the REST API unfortunately only supports bulk send requests. I suggest looking into AMQP if you need higher throughput.

DanielGuarnieri avatar Apr 20 '16 20:04 DanielGuarnieri

the service bus client library is not in this repo anymore, so if this is still an issue, it should go there: https://github.com/azure/azure-service-bus-java

alvadb avatar Jul 25 '17 20:07 alvadb