allthingssecurity commented on PR #27388:
URL: https://github.com/apache/camel/pull/27388#issuecomment-6010435740

   Thanks for the review. On the edge case: both are real, and checking them 
showed that the first commit made the `autoStartup=false` one worse, so I fixed 
both in 099426dd12cc:
   
   - `autoStartup=false`: the container was never started, but 
`doSuspend`/`doResume` still suspended and resumed it. The resume then marked 
it `STARTED` with no connection, so a later `startListenerContainer()` did 
nothing and the consumer never received (on main suspend/resume did nothing, so 
this was a regression of the first commit).
   - `asyncStartListener=true`, suspend before the start task runs: the 
container was suspended before it started, then the start task started it 
fully, so it received while the consumer was suspended. Depending on when the 
queued connection stop ran, it could also end up `STARTED` with a stopped 
connection, which a resume no longer restarts.
   
   Fix: `SjmsConsumer.doSuspend`/`doResume` only act on a started (resp. 
suspended) container. `startListenerContainer()` (used by the async start task 
and by `autoStartup=false` users) suspends the container it just started when 
the consumer is suspended, under the consumer's lifecycle lock, so it cannot 
interleave with a suspend or resume. With the first commit the three new tests 
fail (`testSuspendedBeforeAsyncStart`: ConditionTimeout; 
`testListenerStartedWhileSuspended`: `Expected: <0> but was: <1>`; 
`testSuspendResumeBeforeListenerStarted`: `Expected: <1> but was: <0>`), and 
they pass with the fix. In the async case a few messages can still be delivered 
between the container start and its suspend.
   
   camel-sjms: 134 tests pass (5 skipped) plus 4 ITs; camel-sjms2: 23 tests 
pass.
   
   _Claude Code on behalf of allthingssecurity_
   


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