This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git
The following commit(s) were added to refs/heads/main by this push:
new 63613f080 chore: default data types that the Camel 4.24 data type
changes make possible (#3117) (#3309)
63613f080 is described below
commit 63613f0804350bedb7499ff9aa47f56f67b5322c
Author: Claus Ibsen <[email protected]>
AuthorDate: Fri Nov 20 22:17:01 2026 +0100
chore: default data types that the Camel 4.24 data type changes make
possible (#3117) (#3309)
* chore: default data types on the data format, crypto, Kafka routing and
geo actions (#3117)
- in: binary on json-deserialize-action, jslt-action, crypto-encrypt-action
and crypto-decrypt-action; jslt-action now also takes a Jackson JsonNode,
and crypto-decrypt-action sets Content-Type application/octet-stream.
- in: json on message-timestamp-router-action and value-to-key-action;
Content-Type application/json is no longer needed.
- in: text on nominatim-geocode-action and ogcapi-features-action.
The planned out: struct on json-/avro-/protobuf-deserialize-action and
jsonata-action is left out: Camel's DefaultTransformerRegistry resolves the
from-type transformer (application-x-struct) before it lazy-loads the
to-type
one, so a following Kamelet's input default is skipped (verified with
json-deserialize-action -> value-to-key-action).
Citrus: the crypto test checks the body class and Content-Type after
decrypting, a new jslt test feeds a JsonNode, and the value-to-key test
no longer sets Content-Type.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
* chore: default data types that the Camel 4.24 data type changes make
possible (#3117)
Batch 9c of #3117, stacked on #3299. Needs CAMEL-27270, CAMEL-27271,
CAMEL-27272, CAMEL-27289 and CAMEL-27290 (Camel 4.24.0-SNAPSHOT).
- out struct (application-x-struct) on json-deserialize-action,
avro-deserialize-action, protobuf-deserialize-action and jsonata-action
(which now depends on camel-jackson3). The body stays a Jackson 3
JsonNode.
- out avro-binary on avro-serialize-action and protobuf-binary on
protobuf-serialize-action: the data and its Content-Type are kept.
- out json on fhir-source (a stream becomes bytes, application/fhir+json is
kept; depends on camel-jackson3) and ogcapi-features-action (a String
becomes bytes, the Content-Type of the response is kept).
- No application-x-java-object input on jsonata-action,
json-serialize-action,
jolt-transformation-action, avro-serialize-action and
protobuf-serialize-action: it fails on input they take today; a YAML
comment gives the reason.
- Descriptions: the serializers give a stream; protobuf-serialize-action
fails on JSON text; split of ogcapi-features-action works only with the
Kamelet EIP.
- Citrus: a json-deserialize-action to value-to-key-action chain test; the
avro and protobuf serdes tests record the body class and Content-Type; the
fhir-source and ogcapi tests expect bytes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
---------
Co-authored-by: Claude Opus 5.5 <[email protected]>
---
.../camel-kamelets-catalog-sbom.json | 4 +--
kamelets/avro-deserialize-action.kamelet.yaml | 7 +++++
kamelets/avro-serialize-action.kamelet.yaml | 10 +++++-
kamelets/fhir-source.kamelet.yaml | 11 ++++++-
kamelets/jolt-transformation-action.kamelet.yaml | 3 ++
kamelets/json-deserialize-action.kamelet.yaml | 7 +++++
kamelets/json-serialize-action.kamelet.yaml | 2 ++
kamelets/jsonata-action.kamelet.yaml | 11 +++++++
kamelets/ogcapi-features-action.kamelet.yaml | 13 ++++++--
kamelets/protobuf-deserialize-action.kamelet.yaml | 7 +++++
kamelets/protobuf-serialize-action.kamelet.yaml | 14 +++++++--
.../main/resources/META-INF/kamelets-index.json | 8 ++---
.../kamelets/avro-deserialize-action.kamelet.yaml | 7 +++++
.../kamelets/avro-serialize-action.kamelet.yaml | 10 +++++-
.../resources/kamelets/fhir-source.kamelet.yaml | 11 ++++++-
.../jolt-transformation-action.kamelet.yaml | 3 ++
.../kamelets/json-deserialize-action.kamelet.yaml | 7 +++++
.../kamelets/json-serialize-action.kamelet.yaml | 2 ++
.../resources/kamelets/jsonata-action.kamelet.yaml | 11 +++++++
.../kamelets/ogcapi-features-action.kamelet.yaml | 13 ++++++--
.../protobuf-deserialize-action.kamelet.yaml | 7 +++++
.../protobuf-serialize-action.kamelet.yaml | 14 +++++++--
.../resources/avro/avro-deserialize-route.yaml | 2 ++
.../avro/avro-serdes-action.citrus.it.yaml | 6 ++++
.../test/resources/avro/avro-serialize-route.yaml | 7 +++++
.../fhir/fhir-source-route.citrus.it.yaml | 4 +--
.../ogcapi-features-action-route.citrus.it.yaml | 2 +-
.../json-deserialize-chain-route.citrus.it.yaml} | 36 +++++-----------------
.../json-deserialize-chain-route.yaml} | 32 +++++++++++++------
.../protobuf/protobuf-deserialize-route.yaml | 2 ++
.../protobuf/protobuf-serdes-action.citrus.it.yaml | 6 ++++
.../protobuf/protobuf-serialize-route.yaml | 7 +++++
32 files changed, 222 insertions(+), 64 deletions(-)
diff --git a/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
b/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
index 0984947bc..2f6f56ad1 100644
--- a/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
+++ b/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
@@ -2525,7 +2525,7 @@
"dependsOn" : [ "pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
}, {
"ref" : "kamelet:fhir-source",
- "dependsOn" : [ "pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
+ "dependsOn" : [ "pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
}, {
"ref" : "kamelet:file-watch-source",
"dependsOn" : [
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
@@ -2687,7 +2687,7 @@
"dependsOn" : [
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
}, {
"ref" : "kamelet:jsonata-action",
- "dependsOn" : [
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
+ "dependsOn" : [
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
}, {
"ref" : "kamelet:kafka-batch-manual-commit-action",
"dependsOn" : [ "pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
diff --git a/kamelets/avro-deserialize-action.kamelet.yaml
b/kamelets/avro-deserialize-action.kamelet.yaml
index 579b92f58..0a640dc66 100644
--- a/kamelets/avro-deserialize-action.kamelet.yaml
+++ b/kamelets/avro-deserialize-action.kamelet.yaml
@@ -62,6 +62,13 @@ spec:
format: "application-octet-stream"
description: "The Avro binary data, as bytes."
mediaType: application/octet-stream
+ out:
+ default: struct
+ types:
+ struct:
+ format: "application-x-struct"
+ description: "The parsed JSON, a Jackson `JsonNode`."
+ mediaType: application/x-struct
dependencies:
- "camel:kamelet"
- "camel:jackson3-avro"
diff --git a/kamelets/avro-serialize-action.kamelet.yaml
b/kamelets/avro-serialize-action.kamelet.yaml
index beda7de4d..b2a1d8da6 100644
--- a/kamelets/avro-serialize-action.kamelet.yaml
+++ b/kamelets/avro-serialize-action.kamelet.yaml
@@ -39,7 +39,7 @@ spec:
Input: parsed JSON (a Map or a Jackson `JsonNode`) whose fields match
the schema. JSON text fails: put `json-deserialize-action` before this action
to parse it.
- Output: the body is the Avro binary data, as bytes, and the
`Content-Type` header is set to `application/avro`.
+ Output: the body is the Avro binary data, as a stream, and the
`Content-Type` header is set to `application/avro`.
Good to know: the schema is not written into the data, so whoever reads
it needs the same schema. A message fails when it lacks a field of the schema,
has a field the schema does not know, or has a value of the wrong type. When
`schema` is not set, the schema found by an earlier
`resolve-pojo-schema-action` is used.
type: object
@@ -54,13 +54,21 @@ spec:
description: "Meant to turn the check of the content against the
schema on or off. It has no effect: a message that does not match the schema
always fails."
type: boolean
default: true
+ # No input default: application-x-java-object fails on a Map or a JsonNode
once an earlier
+ # resolve-pojo-schema-action has set contentClass (the X-Content-Class
property) (#3117).
dataTypes:
out:
+ default: avro-binary
headers:
Content-Type:
title: Content Type
description: Always `application/avro`.
type: string
+ types:
+ avro-binary:
+ format: "avro-binary"
+ description: "The Avro binary data, as a stream."
+ mediaType: application/avro
dependencies:
- "camel:kamelet"
- "camel:jackson3-avro"
diff --git a/kamelets/fhir-source.kamelet.yaml
b/kamelets/fhir-source.kamelet.yaml
index cb4d027d3..6648494c6 100644
--- a/kamelets/fhir-source.kamelet.yaml
+++ b/kamelets/fhir-source.kamelet.yaml
@@ -36,7 +36,7 @@ spec:
Use it to copy healthcare records, such as patients or observations,
from a FHIR server into another system, or to check a FHIR server on a
schedule. To create or update resources on a FHIR server, use `fhir-sink`.
- Output: the body is a FHIR Bundle of type `searchset`, as JSON text (a
stream), with the number of resources found (`total`) and the resources
themselves under `entry`. The `Content-Type` header is `application/fhir+json`.
+ Output: the body is a FHIR Bundle of type `searchset`, as JSON text in
bytes, with the number of resources found (`total`) and the resources
themselves under `entry`. The `Content-Type` header is `application/fhir+json`.
Good to know: a new search starts about every half second unless `delay`
is set, and every search returns all the matching resources again, not only the
new ones; add a filter such as `_lastUpdated` to `url` to narrow it. Log in
with `username` and `password`, or with `accessToken`, or leave them out for a
server without login; when both kinds are set, both are sent.
required:
@@ -119,11 +119,20 @@ spec:
description: If true, the JSON in the body is indented over several
lines; if false, it is on one line.
type: boolean
default: true
+ dataTypes:
+ out:
+ default: json
+ types:
+ json:
+ format: "application-json"
+ description: "The FHIR Bundle, as JSON text in bytes, with the
`Content-Type` `application/fhir+json`."
+ mediaType: application/fhir+json
types:
out:
mediaType: application/json
dependencies:
- "camel:fhir"
+ - "camel:jackson3"
- "camel:kamelet"
template:
from:
diff --git a/kamelets/jolt-transformation-action.kamelet.yaml
b/kamelets/jolt-transformation-action.kamelet.yaml
index bc74697cf..1cbb3ed4f 100644
--- a/kamelets/jolt-transformation-action.kamelet.yaml
+++ b/kamelets/jolt-transformation-action.kamelet.yaml
@@ -57,6 +57,9 @@ spec:
type: string
default: "Chainr"
enum: ["Chainr", "Shiftr", "Defaultr", "Removr", "Sortr"]
+ # No default data types: application-x-java-object as input fails on JSON
text, bytes and a
+ # stream, which the Jolt component parses, and as output on the null body
that a specification
+ # matching nothing gives (#3117).
dependencies:
- "camel:jolt"
- "camel:kamelet"
diff --git a/kamelets/json-deserialize-action.kamelet.yaml
b/kamelets/json-deserialize-action.kamelet.yaml
index 3c6ba16fd..20f84b98b 100644
--- a/kamelets/json-deserialize-action.kamelet.yaml
+++ b/kamelets/json-deserialize-action.kamelet.yaml
@@ -50,6 +50,13 @@ spec:
format: "application-octet-stream"
description: "The JSON text, as bytes or a stream."
mediaType: application/octet-stream
+ out:
+ default: struct
+ types:
+ struct:
+ format: "application-x-struct"
+ description: "The parsed JSON, a Jackson `JsonNode`."
+ mediaType: application/x-struct
dependencies:
- "camel:kamelet"
- "camel:jackson3"
diff --git a/kamelets/json-serialize-action.kamelet.yaml
b/kamelets/json-serialize-action.kamelet.yaml
index 50c3d12ea..bb1b38574 100644
--- a/kamelets/json-serialize-action.kamelet.yaml
+++ b/kamelets/json-serialize-action.kamelet.yaml
@@ -42,6 +42,8 @@ spec:
Good to know: a body that is already JSON text is kept as it is, not
quoted: text, bytes or a stream that start with `{` and end with `}`, or start
with `[` and end with `]`, such as `{"id":1}`. It is not checked to be valid
JSON. Any other text becomes one JSON string, in quotes: `hello` becomes
`"hello"`, and the text `42` becomes `"42"`. Bytes or a stream that hold
another JSON value, such as `42`, are kept as well; other bytes become one JSON
string too.
type: object
+ # No input default: application-x-java-object fails on text, bytes, a stream
and a number,
+ # which json-serialize-action writes as JSON (#3117).
dataTypes:
out:
default: json
diff --git a/kamelets/jsonata-action.kamelet.yaml
b/kamelets/jsonata-action.kamelet.yaml
index 4df99ec2b..900b23a2e 100644
--- a/kamelets/jsonata-action.kamelet.yaml
+++ b/kamelets/jsonata-action.kamelet.yaml
@@ -51,7 +51,18 @@ spec:
type: string
example: "file:///etc/camel/order.jsonata"
pattern: "^(http|https|file|classpath|ref|bean)://.*"
+ # No input default: application-x-java-object fails on JSON text, bytes, a
stream and plain text,
+ # which jsonata-action reads (#3117).
+ dataTypes:
+ out:
+ default: struct
+ types:
+ struct:
+ format: "application-x-struct"
+ description: "The parsed JSON, a Jackson `JsonNode`."
+ mediaType: application/x-struct
dependencies:
+ - "camel:jackson3"
- "camel:jsonata"
- "camel:kamelet"
template:
diff --git a/kamelets/ogcapi-features-action.kamelet.yaml
b/kamelets/ogcapi-features-action.kamelet.yaml
index 97018547b..087f36016 100644
--- a/kamelets/ogcapi-features-action.kamelet.yaml
+++ b/kamelets/ogcapi-features-action.kamelet.yaml
@@ -38,9 +38,9 @@ spec:
Input: the body, when it is not empty, is added to the query of the
request, as text such as `name=Lake Baikal`, so each message can ask for other
features. An empty body asks only with the options.
- Output: the body is a GeoJSON feature collection, as JSON text, with at
most `limit` features. The headers of the HTTP response, such as
`Content-Type`, are set as headers.
+ Output: the body is a GeoJSON feature collection, as JSON text in bytes,
with at most `limit` features. The headers of the HTTP response, such as
`Content-Type`, are set as headers.
- Good to know: `split` does not change what the next step receives: it
still gets the whole collection, once per message. An HTTP error from the
server, such as an unknown collection, fails the message. Headers that start
with `CamelHttp` or `CamelRestHttp` are removed from the message first, so they
cannot change what the Kamelet does. The login comes only from the options: an
`Authorization` or `Proxy-Authorization` header on the message is removed, so a
credential that came with [...]
+ Good to know: `split` gives each feature as a message of its own, as
JSON text in bytes with the `Content-Type` `application/json`, only when the
Kamelet is called with the `kamelet` EIP. Called with `to`, as in a Pipe, the
next step still gets the whole collection, once per message, as text. An HTTP
error from the server, such as an unknown collection, fails the message.
Headers that start with `CamelHttp` or `CamelRestHttp` are removed from the
message first, so they cannot chang [...]
required:
- url
- collection
@@ -70,7 +70,7 @@ spec:
default: 10
split:
title: "Split by Feature"
- description: "Meant to give each feature as a message of its own. In a
route or a Pipe it does not change what the next step receives: the whole
feature collection."
+ description: "Gives each feature as a message of its own when the
Kamelet is called with the `kamelet` EIP. Called with `to`, as in a Pipe, it
does not change what the next step receives: the whole feature collection."
type: boolean
default: false
query:
@@ -155,6 +155,13 @@ spec:
format: "text-plain"
description: "More query parameters, such as `name=Lake Baikal`, or
an empty body."
mediaType: text/plain
+ out:
+ default: json
+ types:
+ json:
+ format: "application-json"
+ description: "The GeoJSON feature collection, as JSON text in bytes,
with the `Content-Type` of the response, such as `application/geo+json`."
+ mediaType: application/geo+json
types:
in:
mediaType: text/plain
diff --git a/kamelets/protobuf-deserialize-action.kamelet.yaml
b/kamelets/protobuf-deserialize-action.kamelet.yaml
index 0e9452ec8..6f4ffd94b 100644
--- a/kamelets/protobuf-deserialize-action.kamelet.yaml
+++ b/kamelets/protobuf-deserialize-action.kamelet.yaml
@@ -56,6 +56,13 @@ spec:
format: "application-octet-stream"
description: "The Protobuf binary data, as bytes."
mediaType: application/octet-stream
+ out:
+ default: struct
+ types:
+ struct:
+ format: "application-x-struct"
+ description: "The parsed JSON, a Jackson `JsonNode`."
+ mediaType: application/x-struct
dependencies:
- "camel:kamelet"
- "camel:jackson3-protobuf"
diff --git a/kamelets/protobuf-serialize-action.kamelet.yaml
b/kamelets/protobuf-serialize-action.kamelet.yaml
index b347f57e1..fdbf1650e 100644
--- a/kamelets/protobuf-serialize-action.kamelet.yaml
+++ b/kamelets/protobuf-serialize-action.kamelet.yaml
@@ -36,11 +36,11 @@ spec:
Use it to send records in Protocol Buffers (Protobuf), a compact binary
format described by a schema, to a system that expects it, such as a Kafka
topic whose readers decode Protobuf. To turn Protobuf back into JSON, use
`protobuf-deserialize-action`; for Avro, use `avro-serialize-action`.
- Input: parsed JSON (a Map or a Jackson `JsonNode`) whose fields match
the schema. Put `json-deserialize-action` before this action when the body is
JSON text.
+ Input: parsed JSON (a Map or a Jackson `JsonNode`) whose fields match
the schema. JSON text fails: put `json-deserialize-action` before this action
to parse it.
- Output: the body is the Protobuf binary data, as bytes, and the
`Content-Type` header is set to `application/protobuf`.
+ Output: the body is the Protobuf binary data, as a stream, and the
`Content-Type` header is set to `application/protobuf`.
- Good to know: JSON text is not turned into Protobuf: it is passed on as
it is, yet the `Content-Type` header is set to `application/protobuf`. A
message fails when it has a field the schema does not know or a value of the
wrong type; a field of the schema that the message lacks is left out, even when
it is marked `required`. When `schema` is not set, the schema found by an
earlier `resolve-pojo-schema-action` is used.
+ Good to know: a message fails when it has a field the schema does not
know or a value of the wrong type; a field of the schema that the message lacks
is left out, even when it is marked `required`. When `schema` is not set, the
schema found by an earlier `resolve-pojo-schema-action` is used.
type: object
properties:
schema:
@@ -48,13 +48,21 @@ spec:
description: "The Protobuf schema of the records, in the `.proto`
language: a `message` with its fields, each with a type, a name and a number.
When it is not set, the schema found by an earlier `resolve-pojo-schema-action`
is used."
type: string
example: 'message Person { required string first = 1; required string
last = 2; }'
+ # No input default: application-x-java-object fails on a Map or a JsonNode
once an earlier
+ # resolve-pojo-schema-action has set contentClass (the X-Content-Class
property) (#3117).
dataTypes:
out:
+ default: protobuf-binary
headers:
Content-Type:
title: Content Type
description: Always `application/protobuf`.
type: string
+ types:
+ protobuf-binary:
+ format: "protobuf-binary"
+ description: "The Protobuf binary data, as a stream."
+ mediaType: application/protobuf
dependencies:
- "camel:kamelet"
- "camel:jackson3-protobuf"
diff --git
a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
index 92147c7f6..728f40ebc 100644
--- a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
+++ b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
@@ -15,7 +15,7 @@
"supportLevel" : "Stable",
"title" : "Avro Serialize Action",
"summary" : "Turns each message, a JSON object, into Avro binary data that
follows the Avro schema you give.",
- "description" : "Turns each message, a JSON object, into Avro binary data
that follows the Avro schema you give.\n\nUse it to send records in Avro, a
compact binary format described by a schema, to a system that expects it, such
as a Kafka topic whose readers decode Avro. To turn Avro back into JSON, use
`avro-deserialize-action`; for Protobuf, use
`protobuf-serialize-action`.\n\nInput: parsed JSON (a Map or a Jackson
`JsonNode`) whose fields match the schema. JSON text fails: put `j [...]
+ "description" : "Turns each message, a JSON object, into Avro binary data
that follows the Avro schema you give.\n\nUse it to send records in Avro, a
compact binary format described by a schema, to a system that expects it, such
as a Kafka topic whose readers decode Avro. To turn Avro back into JSON, use
`avro-deserialize-action`; for Protobuf, use
`protobuf-serialize-action`.\n\nInput: parsed JSON (a Map or a Jackson
`JsonNode`) whose fields match the schema. JSON text fails: put `j [...]
"group" : "Actions",
"namespace" : "Transformation",
"provider" : "Apache Software Foundation"
@@ -755,7 +755,7 @@
"supportLevel" : "Stable",
"title" : "FHIR Source",
"summary" : "Runs the same search on a FHIR server of healthcare data over
and over, by default for all the Patient resources, and sends each search
result, a FHIR Bundle, as one message.",
- "description" : "Runs the same search on a FHIR server of healthcare data
over and over, by default for all the Patient resources, and sends each search
result, a FHIR Bundle, as one message.\n\nUse it to copy healthcare records,
such as patients or observations, from a FHIR server into another system, or to
check a FHIR server on a schedule. To create or update resources on a FHIR
server, use `fhir-sink`.\n\nOutput: the body is a FHIR Bundle of type
`searchset`, as JSON text (a stre [...]
+ "description" : "Runs the same search on a FHIR server of healthcare data
over and over, by default for all the Patient resources, and sends each search
result, a FHIR Bundle, as one message.\n\nUse it to copy healthcare records,
such as patients or observations, from a FHIR server into another system, or to
check a FHIR server on a schedule. To create or update resources on a FHIR
server, use `fhir-sink`.\n\nOutput: the body is a FHIR Bundle of type
`searchset`, as JSON text in byte [...]
"group" : "FHIR",
"namespace" : "API",
"provider" : "Apache Software Foundation"
@@ -1605,7 +1605,7 @@
"supportLevel" : "Stable",
"title" : "OGC Api Feature Get Item Action",
"summary" : "Fetches the features of one collection, such as the lakes or
the buildings of an area, from a server that implements the OGC API Features
standard, and gives them as GeoJSON.",
- "description" : "Fetches the features of one collection, such as the lakes
or the buildings of an area, from a server that implements the OGC API Features
standard, and gives them as GeoJSON.\n\nUse it to bring map data from a
geographic data service into a flow, for example to load the features of an
area into a database or to check them against a list of places.\n\nInput: the
body, when it is not empty, is added to the query of the request, as text such
as `name=Lake Baikal`, so ea [...]
+ "description" : "Fetches the features of one collection, such as the lakes
or the buildings of an area, from a server that implements the OGC API Features
standard, and gives them as GeoJSON.\n\nUse it to bring map data from a
geographic data service into a flow, for example to load the features of an
area into a database or to check them against a list of places.\n\nInput: the
body, when it is not empty, is added to the query of the request, as text such
as `name=Lake Baikal`, so ea [...]
"group" : "Geospatial",
"namespace" : "Geo",
"provider" : "Apache Software Foundation"
@@ -1715,7 +1715,7 @@
"supportLevel" : "Stable",
"title" : "Protobuf Serialize Action",
"summary" : "Turns each message, a JSON object, into Protobuf binary data
that follows the Protobuf schema you give.",
- "description" : "Turns each message, a JSON object, into Protobuf binary
data that follows the Protobuf schema you give.\n\nUse it to send records in
Protocol Buffers (Protobuf), a compact binary format described by a schema, to
a system that expects it, such as a Kafka topic whose readers decode Protobuf.
To turn Protobuf back into JSON, use `protobuf-deserialize-action`; for Avro,
use `avro-serialize-action`.\n\nInput: parsed JSON (a Map or a Jackson
`JsonNode`) whose fields match [...]
+ "description" : "Turns each message, a JSON object, into Protobuf binary
data that follows the Protobuf schema you give.\n\nUse it to send records in
Protocol Buffers (Protobuf), a compact binary format described by a schema, to
a system that expects it, such as a Kafka topic whose readers decode Protobuf.
To turn Protobuf back into JSON, use `protobuf-deserialize-action`; for Avro,
use `avro-serialize-action`.\n\nInput: parsed JSON (a Map or a Jackson
`JsonNode`) whose fields match [...]
"group" : "Actions",
"namespace" : "Transformation",
"provider" : "Apache Software Foundation"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/avro-deserialize-action.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/avro-deserialize-action.kamelet.yaml
index 579b92f58..0a640dc66 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/avro-deserialize-action.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/avro-deserialize-action.kamelet.yaml
@@ -62,6 +62,13 @@ spec:
format: "application-octet-stream"
description: "The Avro binary data, as bytes."
mediaType: application/octet-stream
+ out:
+ default: struct
+ types:
+ struct:
+ format: "application-x-struct"
+ description: "The parsed JSON, a Jackson `JsonNode`."
+ mediaType: application/x-struct
dependencies:
- "camel:kamelet"
- "camel:jackson3-avro"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/avro-serialize-action.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/avro-serialize-action.kamelet.yaml
index beda7de4d..b2a1d8da6 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/avro-serialize-action.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/avro-serialize-action.kamelet.yaml
@@ -39,7 +39,7 @@ spec:
Input: parsed JSON (a Map or a Jackson `JsonNode`) whose fields match
the schema. JSON text fails: put `json-deserialize-action` before this action
to parse it.
- Output: the body is the Avro binary data, as bytes, and the
`Content-Type` header is set to `application/avro`.
+ Output: the body is the Avro binary data, as a stream, and the
`Content-Type` header is set to `application/avro`.
Good to know: the schema is not written into the data, so whoever reads
it needs the same schema. A message fails when it lacks a field of the schema,
has a field the schema does not know, or has a value of the wrong type. When
`schema` is not set, the schema found by an earlier
`resolve-pojo-schema-action` is used.
type: object
@@ -54,13 +54,21 @@ spec:
description: "Meant to turn the check of the content against the
schema on or off. It has no effect: a message that does not match the schema
always fails."
type: boolean
default: true
+ # No input default: application-x-java-object fails on a Map or a JsonNode
once an earlier
+ # resolve-pojo-schema-action has set contentClass (the X-Content-Class
property) (#3117).
dataTypes:
out:
+ default: avro-binary
headers:
Content-Type:
title: Content Type
description: Always `application/avro`.
type: string
+ types:
+ avro-binary:
+ format: "avro-binary"
+ description: "The Avro binary data, as a stream."
+ mediaType: application/avro
dependencies:
- "camel:kamelet"
- "camel:jackson3-avro"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/fhir-source.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/fhir-source.kamelet.yaml
index cb4d027d3..6648494c6 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/fhir-source.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/fhir-source.kamelet.yaml
@@ -36,7 +36,7 @@ spec:
Use it to copy healthcare records, such as patients or observations,
from a FHIR server into another system, or to check a FHIR server on a
schedule. To create or update resources on a FHIR server, use `fhir-sink`.
- Output: the body is a FHIR Bundle of type `searchset`, as JSON text (a
stream), with the number of resources found (`total`) and the resources
themselves under `entry`. The `Content-Type` header is `application/fhir+json`.
+ Output: the body is a FHIR Bundle of type `searchset`, as JSON text in
bytes, with the number of resources found (`total`) and the resources
themselves under `entry`. The `Content-Type` header is `application/fhir+json`.
Good to know: a new search starts about every half second unless `delay`
is set, and every search returns all the matching resources again, not only the
new ones; add a filter such as `_lastUpdated` to `url` to narrow it. Log in
with `username` and `password`, or with `accessToken`, or leave them out for a
server without login; when both kinds are set, both are sent.
required:
@@ -119,11 +119,20 @@ spec:
description: If true, the JSON in the body is indented over several
lines; if false, it is on one line.
type: boolean
default: true
+ dataTypes:
+ out:
+ default: json
+ types:
+ json:
+ format: "application-json"
+ description: "The FHIR Bundle, as JSON text in bytes, with the
`Content-Type` `application/fhir+json`."
+ mediaType: application/fhir+json
types:
out:
mediaType: application/json
dependencies:
- "camel:fhir"
+ - "camel:jackson3"
- "camel:kamelet"
template:
from:
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/jolt-transformation-action.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/jolt-transformation-action.kamelet.yaml
index bc74697cf..1cbb3ed4f 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/jolt-transformation-action.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/jolt-transformation-action.kamelet.yaml
@@ -57,6 +57,9 @@ spec:
type: string
default: "Chainr"
enum: ["Chainr", "Shiftr", "Defaultr", "Removr", "Sortr"]
+ # No default data types: application-x-java-object as input fails on JSON
text, bytes and a
+ # stream, which the Jolt component parses, and as output on the null body
that a specification
+ # matching nothing gives (#3117).
dependencies:
- "camel:jolt"
- "camel:kamelet"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/json-deserialize-action.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/json-deserialize-action.kamelet.yaml
index 3c6ba16fd..20f84b98b 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/json-deserialize-action.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/json-deserialize-action.kamelet.yaml
@@ -50,6 +50,13 @@ spec:
format: "application-octet-stream"
description: "The JSON text, as bytes or a stream."
mediaType: application/octet-stream
+ out:
+ default: struct
+ types:
+ struct:
+ format: "application-x-struct"
+ description: "The parsed JSON, a Jackson `JsonNode`."
+ mediaType: application/x-struct
dependencies:
- "camel:kamelet"
- "camel:jackson3"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/json-serialize-action.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/json-serialize-action.kamelet.yaml
index 50c3d12ea..bb1b38574 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/json-serialize-action.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/json-serialize-action.kamelet.yaml
@@ -42,6 +42,8 @@ spec:
Good to know: a body that is already JSON text is kept as it is, not
quoted: text, bytes or a stream that start with `{` and end with `}`, or start
with `[` and end with `]`, such as `{"id":1}`. It is not checked to be valid
JSON. Any other text becomes one JSON string, in quotes: `hello` becomes
`"hello"`, and the text `42` becomes `"42"`. Bytes or a stream that hold
another JSON value, such as `42`, are kept as well; other bytes become one JSON
string too.
type: object
+ # No input default: application-x-java-object fails on text, bytes, a stream
and a number,
+ # which json-serialize-action writes as JSON (#3117).
dataTypes:
out:
default: json
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/jsonata-action.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/jsonata-action.kamelet.yaml
index 4df99ec2b..900b23a2e 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/jsonata-action.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/jsonata-action.kamelet.yaml
@@ -51,7 +51,18 @@ spec:
type: string
example: "file:///etc/camel/order.jsonata"
pattern: "^(http|https|file|classpath|ref|bean)://.*"
+ # No input default: application-x-java-object fails on JSON text, bytes, a
stream and plain text,
+ # which jsonata-action reads (#3117).
+ dataTypes:
+ out:
+ default: struct
+ types:
+ struct:
+ format: "application-x-struct"
+ description: "The parsed JSON, a Jackson `JsonNode`."
+ mediaType: application/x-struct
dependencies:
+ - "camel:jackson3"
- "camel:jsonata"
- "camel:kamelet"
template:
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/ogcapi-features-action.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/ogcapi-features-action.kamelet.yaml
index 97018547b..087f36016 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/ogcapi-features-action.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/ogcapi-features-action.kamelet.yaml
@@ -38,9 +38,9 @@ spec:
Input: the body, when it is not empty, is added to the query of the
request, as text such as `name=Lake Baikal`, so each message can ask for other
features. An empty body asks only with the options.
- Output: the body is a GeoJSON feature collection, as JSON text, with at
most `limit` features. The headers of the HTTP response, such as
`Content-Type`, are set as headers.
+ Output: the body is a GeoJSON feature collection, as JSON text in bytes,
with at most `limit` features. The headers of the HTTP response, such as
`Content-Type`, are set as headers.
- Good to know: `split` does not change what the next step receives: it
still gets the whole collection, once per message. An HTTP error from the
server, such as an unknown collection, fails the message. Headers that start
with `CamelHttp` or `CamelRestHttp` are removed from the message first, so they
cannot change what the Kamelet does. The login comes only from the options: an
`Authorization` or `Proxy-Authorization` header on the message is removed, so a
credential that came with [...]
+ Good to know: `split` gives each feature as a message of its own, as
JSON text in bytes with the `Content-Type` `application/json`, only when the
Kamelet is called with the `kamelet` EIP. Called with `to`, as in a Pipe, the
next step still gets the whole collection, once per message, as text. An HTTP
error from the server, such as an unknown collection, fails the message.
Headers that start with `CamelHttp` or `CamelRestHttp` are removed from the
message first, so they cannot chang [...]
required:
- url
- collection
@@ -70,7 +70,7 @@ spec:
default: 10
split:
title: "Split by Feature"
- description: "Meant to give each feature as a message of its own. In a
route or a Pipe it does not change what the next step receives: the whole
feature collection."
+ description: "Gives each feature as a message of its own when the
Kamelet is called with the `kamelet` EIP. Called with `to`, as in a Pipe, it
does not change what the next step receives: the whole feature collection."
type: boolean
default: false
query:
@@ -155,6 +155,13 @@ spec:
format: "text-plain"
description: "More query parameters, such as `name=Lake Baikal`, or
an empty body."
mediaType: text/plain
+ out:
+ default: json
+ types:
+ json:
+ format: "application-json"
+ description: "The GeoJSON feature collection, as JSON text in bytes,
with the `Content-Type` of the response, such as `application/geo+json`."
+ mediaType: application/geo+json
types:
in:
mediaType: text/plain
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/protobuf-deserialize-action.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/protobuf-deserialize-action.kamelet.yaml
index 0e9452ec8..6f4ffd94b 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/protobuf-deserialize-action.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/protobuf-deserialize-action.kamelet.yaml
@@ -56,6 +56,13 @@ spec:
format: "application-octet-stream"
description: "The Protobuf binary data, as bytes."
mediaType: application/octet-stream
+ out:
+ default: struct
+ types:
+ struct:
+ format: "application-x-struct"
+ description: "The parsed JSON, a Jackson `JsonNode`."
+ mediaType: application/x-struct
dependencies:
- "camel:kamelet"
- "camel:jackson3-protobuf"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/protobuf-serialize-action.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/protobuf-serialize-action.kamelet.yaml
index b347f57e1..fdbf1650e 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/protobuf-serialize-action.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/protobuf-serialize-action.kamelet.yaml
@@ -36,11 +36,11 @@ spec:
Use it to send records in Protocol Buffers (Protobuf), a compact binary
format described by a schema, to a system that expects it, such as a Kafka
topic whose readers decode Protobuf. To turn Protobuf back into JSON, use
`protobuf-deserialize-action`; for Avro, use `avro-serialize-action`.
- Input: parsed JSON (a Map or a Jackson `JsonNode`) whose fields match
the schema. Put `json-deserialize-action` before this action when the body is
JSON text.
+ Input: parsed JSON (a Map or a Jackson `JsonNode`) whose fields match
the schema. JSON text fails: put `json-deserialize-action` before this action
to parse it.
- Output: the body is the Protobuf binary data, as bytes, and the
`Content-Type` header is set to `application/protobuf`.
+ Output: the body is the Protobuf binary data, as a stream, and the
`Content-Type` header is set to `application/protobuf`.
- Good to know: JSON text is not turned into Protobuf: it is passed on as
it is, yet the `Content-Type` header is set to `application/protobuf`. A
message fails when it has a field the schema does not know or a value of the
wrong type; a field of the schema that the message lacks is left out, even when
it is marked `required`. When `schema` is not set, the schema found by an
earlier `resolve-pojo-schema-action` is used.
+ Good to know: a message fails when it has a field the schema does not
know or a value of the wrong type; a field of the schema that the message lacks
is left out, even when it is marked `required`. When `schema` is not set, the
schema found by an earlier `resolve-pojo-schema-action` is used.
type: object
properties:
schema:
@@ -48,13 +48,21 @@ spec:
description: "The Protobuf schema of the records, in the `.proto`
language: a `message` with its fields, each with a type, a name and a number.
When it is not set, the schema found by an earlier `resolve-pojo-schema-action`
is used."
type: string
example: 'message Person { required string first = 1; required string
last = 2; }'
+ # No input default: application-x-java-object fails on a Map or a JsonNode
once an earlier
+ # resolve-pojo-schema-action has set contentClass (the X-Content-Class
property) (#3117).
dataTypes:
out:
+ default: protobuf-binary
headers:
Content-Type:
title: Content Type
description: Always `application/protobuf`.
type: string
+ types:
+ protobuf-binary:
+ format: "protobuf-binary"
+ description: "The Protobuf binary data, as a stream."
+ mediaType: application/protobuf
dependencies:
- "camel:kamelet"
- "camel:jackson3-protobuf"
diff --git
a/tests/camel-kamelets-itest/src/test/resources/avro/avro-deserialize-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/avro/avro-deserialize-route.yaml
index e28a63124..6a7ab476f 100644
---
a/tests/camel-kamelets-itest/src/test/resources/avro/avro-deserialize-route.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/avro/avro-deserialize-route.yaml
@@ -30,3 +30,5 @@
uri: "kamelet:log-action"
parameters:
showHeaders: true
+ # what the serializer gave (from its headers) and what the
deserializer gives
+ - log: "Serialized as ${header.X-Body-Type} ${header.X-Content-Type},
deserialized as ${body.getClass().getName()} ct=${header.Content-Type}"
diff --git
a/tests/camel-kamelets-itest/src/test/resources/avro/avro-serdes-action.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/avro/avro-serdes-action.citrus.it.yaml
index ab9fe148a..4930e3532 100644
---
a/tests/camel-kamelets-itest/src/test/resources/avro/avro-serdes-action.citrus.it.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/avro/avro-serdes-action.citrus.it.yaml
@@ -54,3 +54,9 @@ actions:
integration: "avro-deserialize-route"
logMessage: |
Body: { "id" : "${uuid}", "firstname" : "Sheldon", "lastname" :
"Cooper", "age" : 28}
+ # the serializer gives the binary data as a stream with its Content-Type,
the deserializer parsed JSON without one
+ - camel:
+ cli:
+ verify:
+ integration: "avro-deserialize-route"
+ logMessage: "Serialized as
org.apache.camel.converter.stream.InputStreamCache ct=application/avro,
deserialized as tools.jackson.databind.node.ObjectNode ct="
diff --git
a/tests/camel-kamelets-itest/src/test/resources/avro/avro-serialize-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/avro/avro-serialize-route.yaml
index bff9594c5..d40caf849 100644
---
a/tests/camel-kamelets-itest/src/test/resources/avro/avro-serialize-route.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/avro/avro-serialize-route.yaml
@@ -31,6 +31,13 @@
parameters:
schema: >
{ "name": "User", "type": "record", "namespace":
"demo.kamelets", "fields": [{ "name": "id", "type": "string" }, { "name":
"firstname", "type": "string" }, { "name": "lastname", "type": "string" }, {
"name": "age", "type": "int" }] }
+ # what the Kamelet gives: the Java type of the body and the
Content-Type, sent on as headers
+ - setHeader:
+ name: X-Body-Type
+ simple: "${body.getClass().getName()}"
+ - setHeader:
+ name: X-Content-Type
+ simple: "ct=${header.Content-Type}"
- to:
uri: "kamelet:log-action"
parameters:
diff --git
a/tests/camel-kamelets-itest/src/test/resources/fhir/fhir-source-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/fhir/fhir-source-route.citrus.it.yaml
index ef6cea270..9971985f1 100644
---
a/tests/camel-kamelets-itest/src/test/resources/fhir/fhir-source-route.citrus.it.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/fhir/fhir-source-route.citrus.it.yaml
@@ -67,7 +67,7 @@ actions:
- name: "http.sink.url"
value: "http://localhost:${services.server.port}"
- # the search result: a Bundle of type searchset as JSON text (in a stream),
with the Patient under entry
+ # the search result: a Bundle of type searchset as JSON text in bytes, with
the Patient under entry
- http:
server: "servicesServer"
receiveRequest:
@@ -75,7 +75,7 @@ actions:
path: "/result"
headers:
- name: "X-Body-Type"
- value: 'org.apache.camel.converter.stream.InputStreamCache'
+ value: '[B'
- name: "X-Content-Type"
value: 'ct=application/fhir+json'
body:
diff --git
a/tests/camel-kamelets-itest/src/test/resources/geo/ogcapi-features-action-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/geo/ogcapi-features-action-route.citrus.it.yaml
index ea4ab6ecb..d6bf85bdc 100644
---
a/tests/camel-kamelets-itest/src/test/resources/geo/ogcapi-features-action-route.citrus.it.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/geo/ogcapi-features-action-route.citrus.it.yaml
@@ -56,7 +56,7 @@ actions:
path: "/result"
headers:
- name: "X-Body-Type"
- value: 'java.lang.String'
+ value: '[B'
- name: "X-Content-Type"
value: 'ct=application/geo+json'
body:
diff --git
a/tests/camel-kamelets-itest/src/test/resources/geo/ogcapi-features-action-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/json/json-deserialize-chain-route.citrus.it.yaml
similarity index 59%
copy from
tests/camel-kamelets-itest/src/test/resources/geo/ogcapi-features-action-route.citrus.it.yaml
copy to
tests/camel-kamelets-itest/src/test/resources/json/json-deserialize-chain-route.citrus.it.yaml
index ea4ab6ecb..fbc9513b6 100644
---
a/tests/camel-kamelets-itest/src/test/resources/geo/ogcapi-features-action-route.citrus.it.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/json/json-deserialize-chain-route.citrus.it.yaml
@@ -15,39 +15,18 @@
# limitations under the License.
# ---------------------------------------------------------------------------
-name: ogcapi-features-action-route-test
+name: json-deserialize-chain-route-test
actions:
- camel:
cli:
run:
waitForRunningState: false
integration:
- file: "geo/ogcapi-features-action-route.yaml"
+ file: "json/json-deserialize-chain-route.yaml"
systemProperties:
properties:
- name: "http.sink.url"
value: "http://localhost:${http.server.port}"
- - name: "http.server.port"
- value: "${http.server.port}"
-
- - http:
- server: "httpServer"
- receiveRequest:
- GET:
- path: "/collections/lakes/items"
-
- - http:
- server: "httpServer"
- sendResponse:
- response:
- status: 200
- reasonPhrase: "OK"
- version: "HTTP/1.1"
- headers:
- - name: "Content-Type"
- value: "application/geo+json"
- body:
- data:
'{"type":"FeatureCollection","features":[{"type":"Feature","id":"1","properties":{"name":"Lake
Baikal"},"geometry":{"type":"Point","coordinates":[108.0,53.5]}}]}'
- http:
server: "httpServer"
@@ -56,12 +35,13 @@ actions:
path: "/result"
headers:
- name: "X-Body-Type"
- value: 'java.lang.String'
+ value: '[B'
- name: "X-Content-Type"
- value: 'ct=application/geo+json'
+ value: 'ct=application/json'
+ - name: "X-Kafka-Key"
+ value: '{id=7}'
body:
- data:
'{"type":"FeatureCollection","features":[{"type":"Feature","id":"1","properties":{"name":"Lake
Baikal"},"geometry":{"type":"Point","coordinates":[108.0,53.5]}}]}'
-
+ data: '{"id":7,"customer":"acme","total":12}'
- http:
server: "httpServer"
sendResponse:
@@ -69,5 +49,3 @@ actions:
status: 200
reasonPhrase: "OK"
version: "HTTP/1.1"
- body:
- data: 'OK'
diff --git
a/tests/camel-kamelets-itest/src/test/resources/avro/avro-deserialize-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/json/json-deserialize-chain-route.yaml
similarity index 52%
copy from
tests/camel-kamelets-itest/src/test/resources/avro/avro-deserialize-route.yaml
copy to
tests/camel-kamelets-itest/src/test/resources/json/json-deserialize-chain-route.yaml
index e28a63124..c2565049e 100644
---
a/tests/camel-kamelets-itest/src/test/resources/avro/avro-deserialize-route.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/json/json-deserialize-chain-route.yaml
@@ -15,18 +15,30 @@
# limitations under the License.
# ---------------------------------------------------------------------------
+# json-deserialize-action leaves the message as application-x-struct (parsed
JSON); the input type of the next
+# Kamelet must still run, so value-to-key-action gives JSON text in bytes.
Uses the Kamelet EIP.
- route:
from:
- uri: "kamelet:webhook-source"
+ uri: "timer:tick"
parameters:
- subpath: user
+ period: "1000"
+ repeatCount: 1
steps:
+ - setBody:
+ constant: '{"id":7,"customer":"acme","total":12}'
+ - kamelet:
+ name: "json-deserialize-action"
+ - kamelet:
+ name: "value-to-key-action?fields=id"
+ # what the chain gives: the Java type of the body and the Content-Type
+ - setHeader:
+ name: X-Body-Type
+ simple: "${body.getClass().getName()}"
+ - setHeader:
+ name: X-Content-Type
+ simple: "ct=${header.Content-Type}"
+ - setHeader:
+ name: X-Kafka-Key
+ simple: '${header.CamelKafkaKey}'
- to:
- uri: "kamelet:avro-deserialize-action"
- parameters:
- schema: >
- { "name": "User", "type": "record", "namespace":
"demo.kamelets", "fields": [{ "name": "id", "type": "string" }, { "name":
"firstname", "type": "string" }, { "name": "lastname", "type": "string" }, {
"name": "age", "type": "int" }] }
- - to:
- uri: "kamelet:log-action"
- parameters:
- showHeaders: true
+ uri: "{{http.sink.url}}/result"
diff --git
a/tests/camel-kamelets-itest/src/test/resources/protobuf/protobuf-deserialize-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/protobuf/protobuf-deserialize-route.yaml
index 183bdd0c8..d1fd0dbfc 100644
---
a/tests/camel-kamelets-itest/src/test/resources/protobuf/protobuf-deserialize-route.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/protobuf/protobuf-deserialize-route.yaml
@@ -35,3 +35,5 @@
uri: "kamelet:log-action"
parameters:
showHeaders: true
+ # what the serializer gave (from its headers) and what the
deserializer gives
+ - log: "Serialized as ${header.X-Body-Type} ${header.X-Content-Type},
deserialized as ${body.getClass().getName()} ct=${header.Content-Type}"
diff --git
a/tests/camel-kamelets-itest/src/test/resources/protobuf/protobuf-serdes-action.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/protobuf/protobuf-serdes-action.citrus.it.yaml
index 5e2b4a258..1a4bfb798 100644
---
a/tests/camel-kamelets-itest/src/test/resources/protobuf/protobuf-serdes-action.citrus.it.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/protobuf/protobuf-serdes-action.citrus.it.yaml
@@ -46,3 +46,9 @@ actions:
integration: "protobuf-deserialize-route"
logMessage: |
Body: { "id" : "${uuid}", "firstname" : "Sheldon", "lastname" :
"Cooper", "age" : 28}
+ # the serializer gives the binary data as a stream with its Content-Type,
the deserializer parsed JSON without one
+ - camel:
+ cli:
+ verify:
+ integration: "protobuf-deserialize-route"
+ logMessage: "Serialized as
org.apache.camel.converter.stream.InputStreamCache ct=application/protobuf,
deserialized as tools.jackson.databind.node.ObjectNode ct="
diff --git
a/tests/camel-kamelets-itest/src/test/resources/protobuf/protobuf-serialize-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/protobuf/protobuf-serialize-route.yaml
index ff44bea8d..f86de9838 100644
---
a/tests/camel-kamelets-itest/src/test/resources/protobuf/protobuf-serialize-route.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/protobuf/protobuf-serialize-route.yaml
@@ -36,6 +36,13 @@
optional string lastname=3;
optional int32 age=4;
}
+ # what the Kamelet gives: the Java type of the body and the
Content-Type, sent on as headers
+ - setHeader:
+ name: X-Body-Type
+ simple: "${body.getClass().getName()}"
+ - setHeader:
+ name: X-Content-Type
+ simple: "ct=${header.Content-Type}"
- to:
uri: "kamelet:log-action"
parameters: