Azure / Azure/azure-service-bus-java

Azure Service Bus - ServiceBusProcessorClient-Java- Trytimeout and processing concurrent sessions

Open
#434 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
62
Forks
63
PR merge metrics
No merged PRs in 30d

Description

I am using ServiceBusProcessorClient and AmqpRetryOptions to connect my Azure Service Bus. Facing two issues.

Consumer waits for 30 seconds to process the next message from ASB. Is this due to trytimeout settings? I set to 30 seconds as once we get a message from ASB we call an API and that can sometimes take 30 seconds to respond.

When I have concurrent sessions and max concurrent calls as 4, it will take 4 messages from ASB, but if one of them fails, in the exception block , I do a serviceBusProcessorClient.close() which will stop the consumer and in this case, it will put all 4 messages back in ASB, rather then just the failed one. Any solution available?

```
ampqRetryOptions.setDelay(Duration.ofSeconds(Integer.parseInt(serviceBusConfig.getAmpqDelay())));
ampqRetryOptions.setMaxRetries(<5>);
ampqRetryOptions.setMaxDelay(<1>);
ampqRetryOptions.setMode(AmqpRetryMode.EXPONENTIAL);
ampqRetryOptions.setTryTimeout(<30 seconds>);
serviceBusProcessorClient = new ServiceBusClientBuilder()
.connectionString(connectioString).retryOptions(ampqRetryOptions)
.sessionProcessor().maxConcurrentSessions(4))
.maxConcurrentCalls(4))
.queueName()
.maxAutoLockRenewDuration(50 seconds)
.processMessage(onMessage()).disableAutoComplete()
.processError(onError)
.buildProcessorClient();
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.