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

   # Description
   
   [CAMEL-25838](https://issues.apache.org/jira/browse/CAMEL-25838)
   
   The iggy consumer joined its consumer group once, with the client it 
borrowed at start. Since CAMEL-25289 the client of a failed poll is discarded 
and the pool creates a new client, which only logs in. The Iggy server keeps 
the group membership per connection, and a poll of a client that is not a 
member fails with `ConsumerGroupMemberNotFound` (5006), "so the caller can 
rejoin" (Iggy client contract, `MessageClient.poll_messages`). Camel did not 
rejoin: after one failed poll (dropped connection, server restart) every poll 
failed, once per second, and nothing was consumed until the route was restarted.
   
   Changes:
   - `IggyConsumer` remembers which pooled clients joined the group and makes a 
client join before its first poll (`joinConsumerGroupIfNeeded`); a discarded 
client is forgotten.
   - `IggyEndpoint.joinConsumerGroup` is the join part of 
`initializeConsumerGroup`.
   - A join that fails is handled like a failed poll (the client is discarded, 
the next poll uses a new one).
   - A client that joins the group again logs one INFO line with the consumer 
group, stream and topic, so the recovery after a failed poll can be traced.
   
   No option changed, so no upgrade guide entry.
   
   Tests:
   - New `IggyConsumerRejoinGroupTest` with mocked clients that behave like the 
server here: the first client fails its poll; a client that did not join gets 
`CONSUMER_GROUP_MEMBER_NOT_FOUND`; a member gets one message. Without the 
change it fails (`expected: <[after the failed poll]> but was: <[]>`); with the 
change it passes. A second test, 
`testNewClientJoinsTheGroupAfterTheClientReconnectedOnItsOwn`, covers a client 
that joined and then reconnected by itself: the iggy 0.9.0 TCP client replaces 
a lost connection and logs in again on its own (a Netty `FixedChannelPool` of 
one channel that replays the login) but does not join the group again, so its 
next poll fails with `CONSUMER_GROUP_MEMBER_NOT_FOUND` (5006) although the 
consumer saw it join. That poll fails once, the client is discarded like any 
client of a failed poll, and the new client joins. It also fails without the 
change.
   - camel-iggy unit tests with the change: 19 run, 0 failures.
   
   How it was found: variant analysis of CAMEL-25815 (server-side state tied to 
a connection that the reconnect path does not create again), then the JUnit 
test.
   
   What was not run: an Iggy server (the integration tests need a container); 
the full root build.
   
   # 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): 
[CAMEL-25838](https://issues.apache.org/jira/browse/CAMEL-25838).
   
   # 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 camel-iggy. No option and no component page changed. 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.
   
   _Claude Code on behalf of allthingssecurity_
   
   🤖 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]

Reply via email to