davsclaus opened a new pull request, #24511: URL: https://github.com/apache/camel/pull/24511
## Summary _Claude Code on behalf of davsclaus_ - Add Camel-managed message lock renewal for Azure Service Bus consumers in PEEK_LOCK mode, fixing silent lock expiry for async routes - Use `ServiceBusReceiverAsyncClient` with non-blocking Reactor `Mono` subscriptions for concurrent lock renewals - Integrate with Camel's `PeriodTaskScheduler` for operational visibility (visible via `camel get internal-tasks`) ## Problem The Azure SDK's built-in lock renewal (`maxAutoLockRenewDuration`) is tied to the `processMessage` callback duration. For async Camel routes, this callback returns immediately — the SDK disposes its lock-renewal subscription, and long-running exchanges silently lose their message locks, causing duplicate delivery and data loss. ## Solution A `LockRenewer` inner class (modeled after SQS `TimeoutExtender`) tracks in-flight exchanges in a `ConcurrentHashMap` and periodically renews their message locks via `ServiceBusReceiverAsyncClient.renewMessageLock()`. Lock renewal activates when: - No custom `processorClient` is provided - Receive mode is `PEEK_LOCK` - `maxAutoLockRenewDuration > 0` - Session mode is disabled (session lock renewal is follow-up [CAMEL-23938](https://issues.apache.org/jira/browse/CAMEL-23938)) Exchanges are automatically removed from tracking on completion/failure via `SynchronizationAdapter`. ## Files changed - `ServiceBusClientFactory.java` — Added `createServiceBusReceiverAsyncClient()` factory method - `ServiceBusConsumer.java` — Added `LockRenewer` inner class and lifecycle integration - `ServiceBusConsumerTest.java` — Added 7 tests for lock renewal behavior ## Test plan - [x] Lock renewer created for PEEK_LOCK mode with maxAutoLockRenewDuration > 0 - [x] Lock renewer NOT created for RECEIVE_AND_DELETE mode - [x] Lock renewer NOT created when maxAutoLockRenewDuration is 0 - [x] Lock renewer NOT created for session-enabled consumers - [x] Lock renewer NOT created when custom processorClient provided - [x] Lock renewer tracks and removes exchanges on completion - [x] Shutdown cleans up renewal client and lock renewer - [x] All 30 unit tests pass (`mvn verify`) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.6 <[email protected]> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
