Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
martinkcc opened this issue Jun 19, 2024 · 0 comments

Comments

@martinkcc
Copy link

martinkcc commented Jun 19, 2024

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(<queueName>)
                .maxAutoLockRenewDuration(50 seconds)
                .processMessage(onMessage()).disableAutoComplete()
                .processError(onError)
                .buildProcessorClient();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant