davsclaus opened a new pull request, #28898: URL: https://github.com/apache/camel/pull/28898
Fixes [CAMEL-26121](https://issues.apache.org/jira/browse/CAMEL-26121). ### 1. The component dataStream and dataStreamCallback options were ignored **Wrong:** `FlinkEndpoint.doInit` fell back to the component's `dataSet` and `dataSetCallback`, but not to its `dataStream` and `dataStreamCallback`. With those set only on the component, `flink:datastream` failed with "No DataStream defined". **Changed:** `doInit` now also falls back to the component's `dataStream` and `dataStreamCallback`. ### 2. A DataStream callback always failed with the default collect=true **Wrong:** `collect` defaults to `true`, and `DataStreamFlinkProducer.collectResults` threw "collect mode not supported for Flink DataStreams." whenever the callback returned a `DataStream`. So it failed unless `collect=false` was set. **Changed:** the endpoint records whether `collect` was set explicitly (the setter sets a flag; the option type and its default stay the same, so the catalog and endpoint DSL types do not change). A returned `DataStream` is now the message body and the `CamelFlinkDataStream` header unless `collect=true` was set explicitly, which still fails (now with a hint to use `collect=false`). The `dataset` endpoint is not changed: a returned `DataSet` is still collected by default. ### Tests New `DataStreamComponentOptionsAndCollectTest` (local Flink environment, no external service): - the component's `dataStream` and `dataStreamCallback` are used by `flink:datastream` (failed before the fix) - a returned `DataStream` with the default `collect` is the body and header (failed before the fix) - `collect=false` still returns it, and an explicit `collect=true` still fails Full module build with `-Psourcecheck`: 20 unit tests and 28 ITs pass. ### Docs and generated files - `collect` description updated in `FlinkEndpoint` and in the options table of `flink-component.adoc`; the `@BodyTypes` producerOut description now says what happens to a returned DataStream. - Regenerated `flink.json`, copied it and the adoc into `camel-catalog`, regenerated `FlinkEndpointBuilderFactory` (javadoc only). - Upgrade guide 4.24: new `camel-flink` section, since a DataStream callback that failed before now returns the DataStream, and the component options now apply. ### Not changed - `collect` was not made a nullable `Boolean`, to keep the option type and the endpoint DSL methods unchanged. - Collecting a DataStream (for example with `executeAndCollect`) was not added: on an unbounded stream it never returns. _Claude Code on behalf of Claus Ibsen (davsclaus)_ 🤖 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]
