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

   ## Description
   
   [CAMEL-25029](https://issues.apache.org/jira/browse/CAMEL-25029): first of 
three PRs for the Kafka share group consumer (KIP-932). The plan is in [this 
JIRA 
comment](https://issues.apache.org/jira/browse/CAMEL-25029?focusedCommentId=18124365#comment-18124365):
   
   1. **This PR:** extract a reusable client configuration layer inside 
`camel-kafka`. Refactor only.
   2. Move the shared layer into a flat `camel-kafka-common` module.
   3. Add the `kafka-share` consumer, built on the common layer.
   
   The share consumer cannot reuse `KafkaConfiguration`. `ShareConsumerConfig` 
throws a `ConfigException` on `auto.offset.reset`, `enable.auto.commit`, 
`partition.assignment.strategy`, `session.timeout.ms`, `heartbeat.interval.ms` 
and `group.protocol`, and `createConsumerProperties()` always sets them. So the 
options that every Kafka client shares move to a base class.
   
   ### Changes
   
   - **`KafkaClientConfiguration`** (new, abstract, `@UriParams`) holds 54 
shared options:
     - brokers and client id
     - connection, metrics and backoff
     - SSL, SASL, Kerberos and OAuth
     - deserializers, header filter and header deserializer
     - schema registry, shutdown timeout and additional properties
   
     It also holds the code that writes these options to the client properties: 
`applyCommonClientProperties`, `applySecurityProperties` and 
`applyAdditionalProperties`. The consumer and producer SSL builders were two 
copies of the same logic and are now one method. `KafkaConfiguration` extends 
the new class and keeps all its public getters and setters.
   - **`AbstractKafkaComponent`** (new) holds the client factory, the poll 
exception strategy, the `createConsumerBackoff*` options, global SSL and the 
deferred start of consumers. `KafkaComponent` extends it and keeps the 
configuration, the manual commit factory and the deprecated 
`subscribeConsumer*` options.
   - `KafkaSecurityConfigurer.configure(...)` and 
`KafkaRecordProcessor.propagateHeaders(...)` now take 
`KafkaClientConfiguration`. This is source compatible for callers that pass a 
`KafkaConfiguration`.
   - **Relabelled options:** `connectionMaxIdleMs`, `receiveBufferBytes`, 
`sendBufferBytes`, `metricReporters`, `noOfMetricsSample`, 
`metricsSampleWindowMs` and `reconnectBackoffMs` change from `producer` to 
`common`. They were always written to the consumer properties too. The catalog 
generator drops `producer` options from consumer-only endpoints, so 
`kafka-share` would lose them otherwise. This is the only change in 
`kafka.json`. In the endpoint DSL the options are added to the consumer builder 
and stay on the producer builder.
   
   `KafkaClientFactory.getBrokers(KafkaConfiguration)` is unchanged on purpose: 
camel-quarkus overrides it. PR 3 will add a separate overload for the share 
consumer.
   
   ### Verification
   
   - Before the refactor I captured the consumer and producer client properties 
for 8 configurations: defaults, many options, SSL options, 
`sslContextParameters`, SASL, and `saslAuthType` SCRAM, OAuth and NONE+SSL. 
After the refactor the output is identical. That snapshot test was temporary 
and is not part of this PR.
   - New `KafkaClientConfigurationTest` checks that:
     - the shared options reach both clients
     - the SSL, `sslContextParameters`, SASL and `saslAuthType` properties are 
the same for the producer and the consumer
     - additional properties override the shared options
     - `copy()` gives the copy its own additional properties
   - `mvn install` on `components/camel-kafka`: 232 unit tests and 128 
integration tests (default profile), all green.
   
   No upgrade guide entry: nothing is removed or renamed, and the only 
user-visible change is the label of seven options.
   
   ## 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.
   - [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