davsclaus opened a new pull request, #29106: URL: https://github.com/apache/camel/pull/29106
Fixes [CAMEL-26277](https://issues.apache.org/jira/browse/CAMEL-26277). ### What was wrong `XmppConsumer` registers itself with `chatManager.addIncomingListener(this)`. The chat manager of the account passes every incoming chat message, from any sender, and the consumer did not compare the sender with the `participant` of the endpoint. Since the consumers of one account share its connection, every consumer of the account routed every chat message. A consumer for `dave@...` routed a message from `carol@...`. The component page already describes the participant as a filter: "Consumer configuration, which writes all messages from `joker`". ### What changed - A consumer with a participant and no `room` now routes only the chat messages from that participant. It compares the bare JID of the sender with the resolved participant (a participant without a domain gets the service domain, as before), so any resource of the participant matches. - A consumer without a participant still routes the chat messages of every sender. `getParticipant()` falls back to the user, so the new `XmppEndpoint.hasParticipant()` tells whether a participant was configured. - A room consumer is not changed. It still routes the room messages and the chat messages of every sender. `XmppRouteMultipleProducersSingleConsumerIT` relies on that. - The debug log of a received message logged the participant of the endpoint as the sender. It now logs the `from` of the message. ### Tests `XmppConsumerParticipantTest` runs four consumers of one account against the module's `FakeXmppServer`: one each for carol, dave (with `doc=true`) and `erin` (no domain), and one with no participant. Chats arrive from carol, dave, erin and frank. Each participant consumer gets only its participant's message. The consumer with no participant gets all four. Without the fix, the test fails (`mock://dave` received 4 messages, expected 1). Module: 26 tests, 0 failures, 5 skipped (`mvn clean install -Psourcecheck`). ### Docs and generated files - `xmpp-component.adoc`: new "Receiving chat messages" section, and a new description for the `participant` option. Catalog JSON, catalog doc and endpoint DSL regenerated. - Upgrade guide 4.24: new `camel-xmpp` entry. Users who need the chats of every sender should leave out the participant and read the sender from `CamelXmppFrom`. ### Not changed - Room consumers still route direct chats from every sender, as described above. - With `pubsub=true`, the stanza listener for `normal` and `headline` messages does not look at the participant. Pubsub notifications come from the pubsub service, not from the participant. _Claude Code on behalf of Claus Ibsen (davsclaus)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
