allthingssecurity opened a new pull request, #31010: URL: https://github.com/apache/camel/pull/31010
# Description [CAMEL-27628](https://issues.apache.org/jira/browse/CAMEL-27628) The ticket lists six problems of camel-iggy that came up while the option descriptions were written for CAMEL-23832 (#30965). I checked each one against main. Five are fixed here; for one (2) only the log is fixed and `streamId` keeps what it does. Fixed: 1. **With streamId set, the stream of a CamelIggyStreamOverride header was not created.** `IggyEndpoint.initializeTopic()` looked up the stream by `streamId` and, if it was missing, created the stream of the endpoint (`streamName`), whatever stream the header named. So the stream of the header was never created, and the exchange failed on the topic of a stream that did not exist. `streamId` is now used only when the stream is the one of the endpoint; the stream of the header is looked up and created by its name, as it already was without `streamId`. 2. **The consumer logged getStreamId() as the stream.** It now logs `streamName`, which is set on every consumer. 3. **consumersCount did not add consumers.** `IggyEndpoint.createExecutor()` makes a pool of `consumersCount` threads, but `IggyConsumer.doStart()` submits one `IggyFetchRecords` task. Running several tasks is not only a loop: without `autoCommit` each task keeps its own offset and would read the same messages again, so it needs its own design and a test against a real Iggy server, which I could not run here. As the ticket offers, the option is deprecated, with a note that the consumer polls with one task. Its behaviour does not change. 4. **partitioning could not be set from a String.** The new `IggyConverters` (with a generated loader) converts `balanced`, `partitionId:<partition id>` and `messagesKey:<key>` (prefixes not case-sensitive) to a `Partitioning`, and fails with the accepted forms for other text. A bean reference still works. The option description names the text forms. 5. **password had no security label.** It now has `label = "security"`, as `username` has. 6. **shutdownTimeout was labelled common,consumer.** Only `IggyConsumer.doStop()` reads it, so the label is `consumer`. The endpoint DSL keeps the `shutdownTimeout(...)` methods on the consumer builder, as before. Not changed: 2. **What streamId is for.** It keeps what #30965 documents: the ID that `autoCreateStream` looks up for the stream of the endpoint. As the ticket says, the Iggy Java client 0.9.0 has only `createStream(String)` (checked with javap), so a created stream cannot get that ID. I did not deprecate it, as it still decides whether the stream of the endpoint is created. The behaviour changes of 1 and 4 and the deprecation are in the 4.24 upgrade guide, after the camel-iggy entries that are already there. This touches the same lines as #30965 (`password`, `partitioning`, `consumersCount` and `shutdownTimeout` of `IggyConfiguration`, and the generated files), so the two PRs will conflict textually and whichever is merged second needs a rebase. Two descriptions in #30965 become wrong: - `partitioning`: "How the producer chooses the partition of the messages it sends, as an org.apache.iggy.message.Partitioning: ..." The option now also takes text (`balanced`, `partitionId:2`, `messagesKey:order-1`). - `streamId`: "The ID of a stream that autoCreateStream looks up: if no stream has this ID, a stream named streamName is created." This is now true only for the stream of the endpoint; the stream of a `CamelIggyStreamOverride` header is looked up by its name. #30965 also keeps `label = "common,consumer"` on `shutdownTimeout` and no label on `password`, and its `consumersCount` description should carry the deprecation on a rebase. Tests: - `IggyStreamOverridePartitioningTest` (new, the Iggy client is a Mockito mock as in `IggyMockClientTest`): with `streamId=1`, `initializeTopic()` for the stream of an override header looks up and creates that stream, not the one of the endpoint; for the stream of the endpoint it still looks up the stream by `streamId`; `partitioning=balanced`, `partitionId:3` and `messagesKey:order-1` bind; an unknown text fails the endpoint. Against the main sources 2 of the 4 fail (the stream of the endpoint is created instead of `other`, and `partitioning=balanced` fails to bind); the `streamId` lookup and the unknown text tests pass, as they did before. Results (offline, module build of camel-iggy with a clean target, test phase, unit tests only, no Docker): 30 tests run, 0 failures, 0 errors, 0 skipped. The new test class passed 5 runs in a row. The ITs, which need an Iggy server, were not run. Generated files: `iggy.json` of the component and its catalog copy, `IggyConvertersLoader` and its `META-INF/services` entry, `IggyEndpointBuilderFactory` of the endpoint DSL and `IggyComponentBuilderFactory` of the component DSL. # 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-27628](https://issues.apache.org/jira/browse/CAMEL-27628). # 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 camel-iggy and ran its unit tests, and committed the regenerated component JSON and type converter loader. The catalog copy is a copy of it (the two were identical on main), and the endpoint and component DSL were regenerated from it with the generate-endpoint-dsl and generate-component-dsl goals of camel-package-maven-plugin, as an offline build of those modules was not possible here. 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]
