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

   @davsclaus thanks. Both are done in 8b18c91c2238 (a new commit on top).
   
   **Guard in `resubscribe()`:** it now returns when `!isRunAllowed() || 
subscription != null`. I checked when the window can happen. A route stop/start 
creates a new consumer (`DefaultRoute.gatherRootServices` calls 
`createConsumer` again), and so does a route suspend/resume, because the 
consumer is not `Suspendable`. In both cases the old instance's late attempt 
already sees `isRunAllowed()` false. The window is a stop and start of the 
*same* instance, which is what a route policy does 
(`RoutePolicySupport.stopConsumer`/`startConsumer`).
   
   New test 
`anAttemptThatRunsAfterTheConsumerWasStartedAgainKeepsTheNewSubscription`, with 
no sleeps: the stream fails, then `consumer.stop(); consumer.start()` on the 
same instance, and then the late attempt runs. The test calls `resubscribe()` 
directly, which is now package-private for tests, as the thread that was 
blocked on the lock would. The test checks that `subscribeToEvents` was called 
only twice and that the subscription from the start is not closed. Without the 
guard it fails with `TooManyActualInvocations` (3 calls).
   
   **`configureConsumer`:** folded in. `DaprEndpoint.createConsumer` now calls 
`configureConsumer(consumer)` for both the pub/sub and the configuration 
consumer, so `bridgeErrorHandler` and `exceptionHandler` take effect. 
`aFailureToSubscribeAgainGoesToTheExceptionHandlerAndIsTriedAgain` no longer 
sets the handler on the consumer. The route sets it with 
`exceptionHandler=#recordingHandler`, and the test checks that the failed 
`subscribeToEvents` reaches it. Without `configureConsumer` it fails with 
`expected: <1> but was: <0>`. So no follow-up JIRA is needed for this.
   
   camel-dapr unit tests: 71 run, 0 failures. The formatter and import sort 
made no changes. I updated the description to match.
   
   _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