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

   # Description
   
   [CAMEL-24942](https://issues.apache.org/jira/browse/CAMEL-24942)
   
   SEDA queues are shared by name, because the URI query is dropped from the 
queue key. But each distinct endpoint URI is its own `SedaEndpoint`, with its 
own consumer set and multicast processor, and a consumer thread only multicast 
a polled message to the consumers of its own endpoint. So with 
`multipleConsumers=true`, subscribers whose URIs differ in any other option 
(for example `concurrentConsumers=2` or `pollTimeout=500`) silently competed 
for the messages instead of each receiving a copy. Before the fix, 10 messages 
were split 2/8 or 7/3 instead of 10/10.
   
   This change:
   - The multicast processor of a `multipleConsumers` endpoint now includes the 
active consumers of every `multipleConsumers` endpoint that shares the same 
`QueueReference`. `QueueReference.getEndpoints()` returns a snapshot.
   - A consumer that starts, stops, suspends or resumes also updates the 
multicast processors of the other endpoints of the queue that have consumers. 
Each endpoint's lock is taken on its own, not nested.
   - Consumers on the same endpoint behave as before.
   - The SEDA component docs and the 4.23 upgrade guide describe the behaviour.
   
   Tests: new `SedaMultipleConsumersDifferentOptionsTest` (in camel-core). 
Subscribers on `seda:foo?multipleConsumers=true`, and on the same queue with 
`concurrentConsumers` / `pollTimeout`, must each receive every message. Without 
the fix, the new tests fail (`mock://b Received message count. Expected: <20> 
but was: <15>`, and `<0>` for a consumer added later with other options). With 
the fix, all `*Seda*` tests pass: 134 tests, 0 failures.
   
   Found with a TLA+ model of SEDA publish/subscribe ("each active consumer 
receives each message exactly once"), then reproduced against the real classes.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [ ] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
     (I built and tested the affected modules, including the formatter and 
import-sort plugins. I did not run the full root build.)
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
     This PR was prepared with Claude Code (Claude Opus 5.5). The commit 
carries a `Co-Authored-By` trailer.
   


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