Claus Ibsen created CAMEL-26361:
-----------------------------------

             Summary: camel-azure-servicebus - renew the session lock for 
session-enabled consumers with async routes
                 Key: CAMEL-26361
                 URL: https://issues.apache.org/jira/browse/CAMEL-26361
             Project: Camel
          Issue Type: Bug
          Components: camel-azure-servicebus
            Reporter: Claus Ibsen
             Fix For: 4.24.0


CAMEL-23937 added Camel-managed lock renewal for the Service Bus consumer in 
{{PEEK_LOCK}} mode. The Azure SDK's own renewal is tied to the 
{{processMessage}} callback, which returns at once for an async route, so 
{{maxAutoLockRenewDuration}} had no effect there.

That fix covers only consumers without sessions. In 
{{ServiceBusConsumer.doStart()}}, the {{LockRenewer}} is set up only when 
{{!getConfiguration().isSessionEnabled()}}. With {{sessionEnabled=true}}, a 
route that processes messages asynchronously can still lose the lock before it 
completes or abandons the message, so the message is delivered again.

Session-enabled queues and subscriptions lock the session, not the single 
message, so the existing {{renewMessageLock()}} does not apply. Renewal needs 
{{renewSessionLock()}} on a client bound to the session.

h3. Proposal

* Extend the {{LockRenewer}} (or add a session variant) to renew the session 
lock of each session that has an exchange in flight, until 
{{maxAutoLockRenewDuration}} is reached or the last exchange of that session 
completes.
* Use a receiver bound to the session that delivered the message, created 
through {{ServiceBusClientFactory}} like the existing renewal client.
* Keep the current behaviour when the user supplies their own 
{{processorClient}}.

h3. Tests

A session-enabled consumer with an async route that takes longer than the lock 
duration: the message is completed once and not redelivered. A unit test for 
the renewer with a mocked client.

_Filed by Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to