Ayush0612005 opened a new pull request, #31341: URL: https://github.com/apache/camel/pull/31341
# Description [CAMEL-27940](https://issues.apache.org/jira/browse/CAMEL-27940): the camel-pulsar problems found while improving its option descriptions (#31191). 1. **`batchingMaxMessages` is passed.** `PulsarProducer` passed `maxPendingMessages` as the maximum number of messages in a batch; it now passes `batchingMaxMessages`. Both default to 1000, so the default batch size does not change. 2. **`keySharedPolicy=STICKY` is rejected with a clear message.** `KeySharedPolicy.stickyHashRange()` without ranges can never start (the Pulsar client throws "Ranges for KeyShared policy must not be empty"), so STICKY is dropped from the enum, and an unsupported value now fails with "Unsupported keySharedPolicy: STICKY. Only AUTO_SPLIT is supported.". Supporting STICKY would need a new option for the hash ranges of each consumer; happy to follow up with one if you think it is worth it. 3. **The PulsarClient created by the endpoint is closed.** `PulsarEndpoint` remembers that `doStart` built the client and closes it in `doStop` (a new one is built if the endpoint starts again). A client given to the endpoint or the component is not closed. 4. **Only valid producer limits are passed.** The Pulsar client validates both in its setters: `maxPendingMessagesAcrossPartitions` now gets `max(maxPendingMessagesAcrossPartitions, maxPendingMessages)`, so `maxPendingMessages` above 50000 no longer fails, and `batchingMaxPublishDelay` is only set when `batchingEnabled` is true, so a delay below 1000 microseconds no longer fails a producer without batching. From item 5: `authenticationParams` is marked `secret = true`, and `maxPendingMessagesAcrossPartitions` gets a `deprecationNote`. The descriptions of the changed options are updated, with the component JSON, the catalog copy and the component and endpoint DSL, and the 4.25 upgrade guide describes the changes in behavior. I left `enableRetry` as it is. # Tests The producer tests use the real `ProducerBuilderImpl` of the Pulsar client (as `PulsarProducerInitialSequenceIdTest` does), so the client's own validation runs. - `PulsarProducerOptionsTest`: `batchingMaxMessages=7` with `maxPendingMessages=500` gives batches of 7; `maxPendingMessages=60000` starts, with 60000 across partitions; `batchingEnabled=false&batchingMaxPublishDelayMicros=100` starts. - `PulsarEndpointClientLifecycleTest`: the client the endpoint builds from `serviceUrl` is closed when it stops and a new one is built when it starts again; a client given to the component is not closed. - `CommonCreationStrategyImplTest`: AUTO_SPLIT is passed to the consumer builder, and STICKY is rejected with the new message. With the main changes reverted, each of these fails. The unit tests of camel-pulsar pass (1075). I could not run the integration tests (no Docker on this machine). # 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 built camel-pulsar with `install` (including `formatter:format` and `impsort:sort`). _Claude Code on behalf of Ayush0612005_ -- 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]
