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

   ## Description
   
   Refactor only. `KafkaIdempotentRepository` and `KafkaKeyValueRepository` had 
copies of the same Kafka code (CPD flagged about 260 duplicated lines across 7 
blocks):
   
   - the consumer and producer properties (bootstrap servers and group id 
defaults, `enable.auto.commit=false`, `acks`/`batch.size` defaults, key and 
value serdes);
   - reading the topic from the beginning on start, and the background sync 
thread (`TopicPoller`);
   - the synchronous send to the topic;
   - stopping (wakeup, executor shutdown, closing the clients).
   
   That code is now in `KafkaChangelog<V>`, next to `KafkaConsumerUtil` in 
`org.apache.camel.processor.idempotent.kafka`, with `V` being the record value 
type (`String` for the idempotent repository, `byte[]` for the key-value one). 
Each repository keeps its options, its local cache, its record format and its 
rollback when a send fails. The log messages and the name of the background 
thread are unchanged.
   
   The getters and setters of the options stay in each repository: the bean 
metadata generator (`GeneratePojoBeanMojo`) only reads the fields declared on 
the bean class, so moving the options to a shared class would remove them from 
the bean documentation. The generated bean metadata and configurers are 
unchanged.
   
   `KafkaIdempotentRepositoryTest` set the private `producer` field by 
reflection; it now injects a `KafkaChangelog` built with its `MockProducer`.
   
   This was split out of #27495 (Kafka share groups, CAMEL-25029) at review, 
since it is unrelated to share groups.
   
   ### Verification
   
   - `camel-kafka` unit tests: 220, green. `-Psourcecheck` green.
   - Repository ITs: `KafkaIdempotentRepositoryEagerIT`, 
`KafkaIdempotentRepositoryNonEagerIT`, 
`KafkaIdempotentRepositoryPersistenceIT`, `KafkaConsumerIdempotent*IT` (4) and 
`KafkaKeyValueRepositoryIT` (23 tests), all green.
   
   ## Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   ## Tracking
   
   - [ ] 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). (Internal refactor, no 
behaviour change.)
   
   ## Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [x] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
   
   _Claude Code on behalf of Croway_
   


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