davsclaus opened a new pull request, #3310:
URL: https://github.com/apache/camel-kamelets/pull/3310

   Four description fixes and one dependency fix, each checked with `camel run` 
on Camel 4.24.0-SNAPSHOT and with Citrus tests.
   
   ## aws-cloudwatch-sink: the body is not always ignored
   
   The description said "the body is not used". The `aws2-cw` producer 
(`Cw2Producer.getMetricData`) reads it, and the Kamelet passes it on:
   
   - An AWS SDK `MetricDatum` body is sent as it is. The metric headers and 
options (name, value, unit, dimension, timestamp) are then not used; only 
`cwNamespace` is.
   - A List or an array of `MetricDatum` is sent as one data point for each.
   - A List or an array of anything else, such as a List of text, fails the 
message with `IllegalArgumentException` ("The body must be a MetricDatum or a 
collection or an array of MetricDatum ...").
   - Any other body (text, a Map, JSON text, a Jackson `ArrayNode`) is not 
used, and the data point comes from the headers and options, as before.
   
   The Input paragraph now says this. New Citrus test 
`aws/cloudwatch/aws-cloudwatch-sink-body-route`, run against Floci, covers all 
three body cases. It sends a `MetricDatum` with the metric headers also set, 
and checks in CloudWatch that the datum was stored and the header metric was 
not. It also checks the List of `MetricDatum`, and that a List of text fails 
with `IllegalArgumentException`.
   
   ## kafka-manual-commit-action and kafka-batch-manual-commit-action: add 
`camel:kafka`
   
   Both only listed `camel:kamelet` but reference 
`org.apache.camel.component.kafka.ManualCommit` / `BatchManualCommit`. When 
`kafka-source` was not in the same integration, `camel run` failed at startup:
   
   ```
   NoSuchBeanException: No bean could be found in the registry for: 
org.apache.camel.component.kafka.ManualCommit
   ```
   
   The batch action failed in the same way, so this PR fixes it too. After 
adding `camel:kafka`, both actions start and pass the message on unchanged. New 
Citrus tests `kafka/kafka-manual-commit-action-without-source-route` and 
`kafka/kafka-batch-manual-commit-action-without-source-route` each run one 
action alone, without a Kafka container. The generated SBOM and index are 
updated.
   
   ## json-serialize-action: JSON text is not quoted
   
   The description said JSON text is quoted like any other text. On Camel 4.24 
(since CAMEL-25329 in 4.23) it is not:
   
   | Body in | Body out |
   |---|---|
   | Map / List / `JsonNode` | JSON text |
   | text `{"a":1,"b":"x"}`, `[1,2]` | unchanged, not quoted |
   | text `{not json}` (starts with `{`, ends with `}`) | unchanged; it is not 
checked to be valid JSON |
   | text `hello`, `42`, `{not json`, `"quoted"` | one JSON string: `"hello"`, 
`"42"`, ... |
   | bytes or stream holding `{...}`, `[...]` or `42` | unchanged |
   | bytes or stream `hello` | `"hello"` |
   
   The Good to know paragraph now says this. The Citrus test also checks that 
JSON text stays unquoted and that `hello` becomes `"hello"`.
   
   ## jolt-transformation-action: a JsonNode gives a null body
   
   A Jackson `JsonNode` (Jackson 3, as `json-deserialize-action` gives, or 
Jackson 2) is passed to Jolt as it is. Jolt finds no fields in it, so the body 
becomes null with no error. Text that is not a JSON object or array, such as 
`hello`, also gives null. JSON text, bytes and a Map work. Adding 
`json-serialize-action` before Jolt makes a `JsonNode` work. The Input and Good 
to know paragraphs now say this. The Citrus test now checks the null body and 
the `json-serialize-action` workaround.
   
   ## tika-extract-text-action: `html` fails for a document without a title
   
   The `outputFormat` description said that, with `html` and `xml`, a NUL 
character in the metadata fails the message (from #3230). With `camel run` on 
JDK 25 and Camel 4.24.0-SNAPSHOT, I saw this instead:
   
   | Input | `text` | `html` | `xml` |
   |---|---|---|---|
   | plain text (as text or as bytes) | OK | **fails** | OK |
   | HTML without `<title>` | OK | **fails** | OK |
   | HTML with an empty `<title></title>` | OK | **fails** | OK |
   | HTML with a title | OK | OK | OK |
   
   The failure is `TikaException: TIKA-237: Illegal SAXException ...`, caused 
by `An invalid XML character (Unicode: 0x0) was found in the node's character 
data content`. `html` wraps the output in Tika's `ExpandedTitleContentHandler` 
(`TikaProducer`), so this is a camel-tika bug, and a JIRA is being filed. I did 
not find any input for which `xml` fails. The NUL sentence is replaced with 
what I observed: with `html`, a document without a title fails the message, and 
`xml` reads it.
   
   The templates and data types are unchanged, so there is no behaviour change 
and no upgrade note.
   
   ## Checks
   
   - `./mvnw clean install` from the root, run twice: BUILD SUCCESS.
   - Citrus, all passing: `AwsIT#awsCloudWatch` (2 tests), `KafkaIT` (8, 
including the 2 new ones), `CommonIT#json` (3), `CommonIT#transformation` (17) 
and `CommonIT#langchain4jIngest` (11, which includes the 4 Tika tests).
   - The Tika description change has no Citrus test, because a test would only 
lock in the `html` bug.
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
   


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