Croway opened a new pull request, #23639:
URL: https://github.com/apache/camel/pull/23639

   ## Summary
   
   The `BackOff` → `BackgroundTask` migration (CAMEL-22206) preserved callback 
return values verbatim, but the two APIs have **opposite boolean semantics**: 
`BackOff` returns `false` to stop, `BackgroundTask` returns `true` to stop. 
This caused infinite retry loops after successful recovery in three components.
   
   **camel-sjms/sjms2** — after a transient JMS connection interruption 
(reported with Oracle AQ), the consumer enters an infinite recovery loop. Each 
iteration destroys the working connection via `refreshConnection()` while 
`initConsumers()` skips re-creation (`consumers != null`), leaving consumers 
attached to closed sessions. Message consumption is permanently blocked.
   
   **camel-pgevent** — after successful PostgreSQL reconnection, the task keeps 
calling `initConnection()` every `reconnectDelay`, leaking connections and 
duplicating notification listeners.
   
   **camel-master** — after the delegated consumer starts, the task keeps 
calling `ServiceHelper.startService()` until budget exhaustion (default 10 
iterations). Can revive a consumer after leadership loss.
   
   ## Changes
   
   - `SimpleMessageListenerContainer.recoverConnection()`: `return false` → 
`return true`
   - `SimpleMessageListenerContainer.scheduleConnectionRecovery()`: allow 
re-scheduling after a completed task (`!recoverTask.isRunning()`)
   - `PgEventConsumer.PgEventListener.reconnect()`: `return false` → `return 
true`
   - `MasterConsumer.onLeadershipTaken()`: `return false` → `return true`
   - New test: `SjmsConnectionRecoveryTest` — uses ArtemisContainer 
(Testcontainers), simulates `onException`, verifies consumer resumes after 
recovery. Fails without fix, passes with fix.
   
   ## Test plan
   
   - [x] `SjmsConnectionRecoveryTest` — fails without fix, passes with fix
   - [ ] Existing `camel-sjms` test suite passes
   - [ ] Existing `camel-master` test suite (20 tests) passes
   - [ ] Existing `camel-pgevent` IT tests pass (require PostgreSQL Docker)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   _Claude Code on behalf of Federico Mariani_


-- 
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]

Reply via email to