atiaomar1978-hub opened a new pull request, #25558: URL: https://github.com/apache/camel/pull/25558
## Summary _AI-generated on behalf of atiaomar1978-hub._ Fixes [CAMEL-24408](https://issues.apache.org/jira/browse/CAMEL-24408): when a SEDA producer and consumer share the same endpoint URI with `discardIfNoConsumers=true`, removing the consumer route must silently discard subsequent messages instead of throwing `SedaConsumerNotAvailableException`. ## Root cause Removing a consumer route triggered partial endpoint shutdown that tore down the shared queue reference while producers were still active: 1. `SedaComponent.onShutdownEndpoint()` removed the shared `QueueReference` when consumers were empty, without checking for active producers on the same or related endpoints. 2. `SedaEndpoint.shutdown()` called `super.shutdown()` when only consumers were gone, clearing the local queue state. 3. `SedaProducer.addToQueue()` threw before reaching the `discardIfNoConsumers` check when the queue reference was null. ## Fix - Keep the shared queue reference while any related endpoint still has active producers (`QueueReference.hasProducers()`). - Skip removing endpoint references and full shutdown when producers remain on the endpoint. - Discard messages when `discardIfNoConsumers=true` even if the queue reference is temporarily unavailable (defensive guard). ## Tests Added `SedaDiscardIfNoConsumerAfterRemovalTest` covering: - Discard after consumer route removal with shared URI - Queue reference retained while producer route remains - `failIfNoConsumers=true` still throws after consumer removal ## Affected versions Bug reported in 4.19.0 and 4.22.0; backport PRs will follow for `camel-4.19.x` and `camel-4.22.x`. -- 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]
