This is an automated email from the ASF dual-hosted git repository.
oscerd 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 24f3a3676 chore: default data types on the Messaging and Kafka
Kamelets where the body is fixed (#3117) (#3275)
24f3a3676 is described below
commit 24f3a3676b600ac43dee7ab9f194c2832b423d7f
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Nov 19 18:30:37 2026 +0100
chore: default data types on the Messaging and Kafka Kamelets where the
body is fixed (#3117) (#3275)
- pulsar-sink, mqtt5-sink: in default binary (application-octet-stream).
The body is turned into byte[] and Content-Type set to
application/octet-stream before sending; both send the same bytes as
before (the producers convert to byte[] themselves and send no headers),
but the message after the sink is byte[] instead of String.
- value-to-key-action, message-timestamp-router-action: out default json
(application-json). The body is byte[] instead of a stream
(InputStreamCache); Content-Type stays application/json.
- kafka-batch-source: the description says each List entry is a Camel
Exchange, read with getMessage().getBody(), not a message.
- Descriptions updated; the pulsar-sink, value-to-key-action and
message-timestamp-router-action Citrus tests expect [B and the new
Content-Type, and pulsar-sink checks its text through an X-Body header.
No default on the sources: a source Kamelet's out default runs only after
the whole consuming route, not before it, and fails the exchange there
when the route ends with a Map or a number. No default on the JMS,
spring-rabbitmq, nats, smpp and kafka sinks, kafka-source,
kafka-batch-source, smpp-source and the header-only Kafka actions.
Co-authored-by: Claude Opus 5.5 <[email protected]>
---
kamelets/kafka-batch-source.kamelet.yaml | 2 +-
kamelets/message-timestamp-router-action.kamelet.yaml | 8 +++++++-
kamelets/mqtt5-sink.kamelet.yaml | 12 ++++++++++--
kamelets/pulsar-sink.kamelet.yaml | 10 ++++++++--
kamelets/value-to-key-action.kamelet.yaml | 8 +++++++-
.../src/main/resources/META-INF/kamelets-index.json | 10 +++++-----
.../main/resources/kamelets/kafka-batch-source.kamelet.yaml | 2 +-
.../kamelets/message-timestamp-router-action.kamelet.yaml | 8 +++++++-
.../src/main/resources/kamelets/mqtt5-sink.kamelet.yaml | 12 ++++++++++--
.../src/main/resources/kamelets/pulsar-sink.kamelet.yaml | 10 ++++++++--
.../main/resources/kamelets/value-to-key-action.kamelet.yaml | 8 +++++++-
.../message-timestamp-router-action-route.citrus.it.yaml | 2 +-
.../kafkarouter/value-to-key-action-route.citrus.it.yaml | 2 +-
.../test/resources/pulsar/pulsar-sink-route.citrus.it.yaml | 11 +++++------
.../src/test/resources/pulsar/pulsar-sink-route.yaml | 3 +++
15 files changed, 81 insertions(+), 27 deletions(-)
diff --git a/kamelets/kafka-batch-source.kamelet.yaml
b/kamelets/kafka-batch-source.kamelet.yaml
index 998eb6626..76a1a947b 100644
--- a/kamelets/kafka-batch-source.kamelet.yaml
+++ b/kamelets/kafka-batch-source.kamelet.yaml
@@ -35,7 +35,7 @@ spec:
Use it to handle many records at once, for example to write them to a
database in one go, or to save the position in Kafka only once a whole batch
was handled. To handle one record at a time use `kafka-source`.
- Output: the body is a List with one entry per record, up to `batchSize`.
Each entry is a message of its own, with the value of the record as its body
(text), and the key, offset and timestamp of the record in its `CamelKafkaKey`,
`CamelKafkaOffset` and `CamelKafkaTimestamp` headers. The record headers are in
the entries too, as bytes. The message itself has the `CamelKafkaTopic` and
`CamelKafkaPartition` headers. The `kafka-topic`, `kafka-key` and other headers
of `kafka-source` ar [...]
+ Output: the body is a List with one entry per record, up to `batchSize`.
Each entry is a Camel `Exchange` for one record, not a message: a step reads
the value of the record, as text, with `getMessage().getBody()` on the entry,
such as `${body[0].getMessage().getBody()}`. The message of the entry also has
the key, offset and timestamp of the record in its `CamelKafkaKey`,
`CamelKafkaOffset` and `CamelKafkaTimestamp` headers, and the record headers,
as bytes. The message itself has [...]
Good to know: `saslAuthType` has no default and must be set; `NONE`
connects with no login and no TLS. To save the position in Kafka only once a
batch was handled, set `allowManualCommit` to true and `autoCommitEnable` to
false, and end the flow with `kafka-batch-manual-commit-action`. A new consumer
group starts at the newest records, unless `autoOffsetReset` is `earliest`.
Without `consumerGroup`, every start uses a new group, so the records sent
while the integration was stopped [...]
required:
diff --git a/kamelets/message-timestamp-router-action.kamelet.yaml
b/kamelets/message-timestamp-router-action.kamelet.yaml
index 1c3da8f03..0bafd59bb 100644
--- a/kamelets/message-timestamp-router-action.kamelet.yaml
+++ b/kamelets/message-timestamp-router-action.kamelet.yaml
@@ -37,7 +37,7 @@ spec:
Input: a JSON object as JSON text, with the `Content-Type` header set to
`application/json`. The name of the topic is read from the `CamelKafkaTopic`
header, which `kafka-source` sets.
- Output: the same JSON object, as JSON text in a stream, with
`Content-Type` set to `application/json`. When one of the `timestampKeys`
fields is found, the `CamelKafkaOverrideTopic` header is set to the new name,
and `kafka-sink` writes the record to that topic instead of its own `topic`.
+ Output: the same JSON object, as JSON text in bytes, with `Content-Type`
set to `application/json`. When one of the `timestampKeys` fields is found, the
`CamelKafkaOverrideTopic` header is set to the new name, and `kafka-sink`
writes the record to that topic instead of its own `topic`.
Good to know: a field value that cannot be read as a date with
`timestampKeyFormat` makes the message fail. The default `topicFormat` of
`topic-$[timestamp]` gives names such as `topic-20240703`, without the original
name: set it to `$[topic]-$[timestamp]` to keep it. The date is in UTC.
required:
@@ -79,6 +79,12 @@ spec:
description: "Must be `application/json`."
type: string
out:
+ default: json
+ types:
+ json:
+ format: "application-json"
+ description: "The same JSON object, as JSON text in bytes."
+ mediaType: application/json
headers:
CamelKafkaOverrideTopic:
title: Kafka Override Topic
diff --git a/kamelets/mqtt5-sink.kamelet.yaml b/kamelets/mqtt5-sink.kamelet.yaml
index e057411c4..dc0bb87c5 100644
--- a/kamelets/mqtt5-sink.kamelet.yaml
+++ b/kamelets/mqtt5-sink.kamelet.yaml
@@ -35,9 +35,9 @@ spec:
Use it to send commands or data to IoT devices, or to publish readings
and events, when the broker or the clients use MQTT 5. The broker must support
MQTT 5.
- Input: the body is the payload, as text or bytes, and is sent as it is.
Turn structured data such as a Map into JSON text first, for example with
`json-serialize-action`. The headers of the message are not sent, not even as
MQTT 5 user properties.
+ Input: the body is the payload, as text or bytes. It is turned into
bytes, and the `Content-Type` header is set to `application/octet-stream`,
before it is sent. Turn structured data such as a Map into JSON text first, for
example with `json-serialize-action`. The headers of the message are not sent,
not even as MQTT 5 user properties.
- Output: the message is unchanged.
+ Output: the body is the payload, as bytes, and the `Content-Type` header
is `application/octet-stream`. The other headers are kept.
Good to know: messages are published with quality of service 2 (exactly
once) unless `qos` is set, and the broker does not keep them for clients that
subscribe later unless `retained` is true. It connects with no TLS unless
`brokerUrl` starts with `ssl://`. With TLS it checks the certificate and the
host name of the broker, and trusts the certificate authorities that Java
trusts by default, or instead the ones in `sslTruststoreLocation`. It connects
when the integration starts, and [...]
required:
@@ -90,6 +90,14 @@ spec:
format: password
x-descriptors:
- urn:camel:group:credentials
+ dataTypes:
+ in:
+ default: binary
+ types:
+ binary:
+ format: "application-octet-stream"
+ description: "The payload to publish, as bytes."
+ mediaType: application/octet-stream
dependencies:
- "camel:paho-mqtt5"
- "camel:kamelet"
diff --git a/kamelets/pulsar-sink.kamelet.yaml
b/kamelets/pulsar-sink.kamelet.yaml
index a89fb7fb4..60600f338 100644
--- a/kamelets/pulsar-sink.kamelet.yaml
+++ b/kamelets/pulsar-sink.kamelet.yaml
@@ -30,6 +30,12 @@ metadata:
spec:
dataTypes:
in:
+ default: binary
+ types:
+ binary:
+ format: "application-octet-stream"
+ description: "The payload to send, as bytes."
+ mediaType: application/octet-stream
headers:
key:
title: "Message Key"
@@ -53,9 +59,9 @@ spec:
Use it to publish events or data for other applications to read from
Pulsar, such as orders or sensor readings. Use `pulsar-source` to read them.
- Input: the body is the payload, as text or bytes. A Map fails: turn it
into JSON text first, for example with `json-serialize-action`. The headers of
the message are not sent as Pulsar properties; to set properties, put a Map in
the `CamelPulsarProducerMessageProperties` header. The optional `key` header
becomes the key of the message, as the `key` header that `pulsar-source` sets;
the `CamelPulsarProducerMessageKey` header takes precedence over it.
+ Input: the body is the payload, as text or bytes. It is turned into
bytes, and the `Content-Type` header is set to `application/octet-stream`,
before it is sent. A Map fails: turn it into JSON text first, for example with
`json-serialize-action`. The headers of the message are not sent as Pulsar
properties; to set properties, put a Map in the
`CamelPulsarProducerMessageProperties` header. The optional `key` header
becomes the key of the message, as the `key` header that `pulsar-sou [...]
- Output: the message is unchanged.
+ Output: the body is the payload, as bytes, and the `Content-Type` header
is `application/octet-stream`. The other headers are kept.
Good to know: it connects with no TLS and no login, unless `serviceUrl`
starts with `pulsar+ssl://` and `authenticationClass` is set. Over TLS, the
certificate of Pulsar must be signed by an authority that the Java trust store
of the integration trusts, or by one in the PEM file of
`tlsTrustCertsFilePath`, such as a private one, and it must be issued for the
host name in `serviceUrl`. It connects when the integration starts, and the
integration fails to start when Pulsar cannot be [...]
required:
diff --git a/kamelets/value-to-key-action.kamelet.yaml
b/kamelets/value-to-key-action.kamelet.yaml
index e9181894c..d0cb68c9a 100644
--- a/kamelets/value-to-key-action.kamelet.yaml
+++ b/kamelets/value-to-key-action.kamelet.yaml
@@ -37,7 +37,7 @@ spec:
Input: a JSON object as JSON text, with the `Content-Type` header set to
`application/json`.
- Output: the same JSON object, as JSON text in a stream, with
`Content-Type` set to `application/json`. The `CamelKafkaKey` header, which
`kafka-sink` uses as the key of the record, is set to a Map of the fields named
in `fields` and their values.
+ Output: the same JSON object, as JSON text in bytes, with `Content-Type`
set to `application/json`. The `CamelKafkaKey` header, which `kafka-sink` uses
as the key of the record, is set to a Map of the fields named in `fields` and
their values.
Good to know: `kafka-sink` writes the key as text such as `{id=7,
customer=acme}`, not as JSON, and not necessarily with the fields in the order
of `fields`. A field that is not in the body is left out of the key.
required:
@@ -57,6 +57,12 @@ spec:
description: "Must be `application/json`."
type: string
out:
+ default: json
+ types:
+ json:
+ format: "application-json"
+ description: "The same JSON object, as JSON text in bytes."
+ mediaType: application/json
headers:
CamelKafkaKey:
title: Kafka Key
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 4da1016ca..5cab801fa 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
@@ -1315,7 +1315,7 @@
"supportLevel" : "Stable",
"title" : "Kafka Batch Source",
"summary" : "Receives records from one or more topics in Apache Kafka in
batches, as one message that holds a list of up to `batchSize` records.",
- "description" : "Receives records from one or more topics in Apache Kafka
in batches, as one message that holds a list of up to `batchSize`
records.\n\nUse it to handle many records at once, for example to write them to
a database in one go, or to save the position in Kafka only once a whole batch
was handled. To handle one record at a time use `kafka-source`.\n\nOutput: the
body is a List with one entry per record, up to `batchSize`. Each entry is a
message of its own, with the valu [...]
+ "description" : "Receives records from one or more topics in Apache Kafka
in batches, as one message that holds a list of up to `batchSize`
records.\n\nUse it to handle many records at once, for example to write them to
a database in one go, or to save the position in Kafka only once a whole batch
was handled. To handle one record at a time use `kafka-source`.\n\nOutput: the
body is a List with one entry per record, up to `batchSize`. Each entry is a
Camel `Exchange` for one record, [...]
"group" : "Kafka",
"namespace" : "Kafka",
"provider" : "Apache Software Foundation"
@@ -1445,7 +1445,7 @@
"supportLevel" : "Stable",
"title" : "Message Timestamp Router Action",
"summary" : "Changes the topic that `kafka-sink` writes a record to, to a
name made of the original topic name and a date read from a field of the JSON
body.",
- "description" : "Changes the topic that `kafka-sink` writes a record to,
to a name made of the original topic name and a date read from a field of the
JSON body.\n\nUse it to spread the records over one topic per day or per month
by a date in the data, such as the date of an order, in a flow from
`kafka-source` to `kafka-sink`. To use the time the record was written to Kafka
instead use `timestamp-router-action`.\n\nInput: a JSON object as JSON text,
with the `Content-Type` header se [...]
+ "description" : "Changes the topic that `kafka-sink` writes a record to,
to a name made of the original topic name and a date read from a field of the
JSON body.\n\nUse it to spread the records over one topic per day or per month
by a date in the data, such as the date of an order, in a flow from
`kafka-source` to `kafka-sink`. To use the time the record was written to Kafka
instead use `timestamp-router-action`.\n\nInput: a JSON object as JSON text,
with the `Content-Type` header se [...]
"group" : "Actions",
"namespace" : "Kafka",
"provider" : "Apache Software Foundation"
@@ -1505,7 +1505,7 @@
"supportLevel" : "Stable",
"title" : "MQTT v5 Sink",
"summary" : "Publishes each message to a topic on an MQTT broker, such as
Eclipse Mosquitto or HiveMQ, with MQTT 5.",
- "description" : "Publishes each message to a topic on an MQTT broker, such
as Eclipse Mosquitto or HiveMQ, with MQTT 5.\n\nUse it to send commands or data
to IoT devices, or to publish readings and events, when the broker or the
clients use MQTT 5. The broker must support MQTT 5.\n\nInput: the body is the
payload, as text or bytes, and is sent as it is. Turn structured data such as a
Map into JSON text first, for example with `json-serialize-action`. The headers
of the message are no [...]
+ "description" : "Publishes each message to a topic on an MQTT broker, such
as Eclipse Mosquitto or HiveMQ, with MQTT 5.\n\nUse it to send commands or data
to IoT devices, or to publish readings and events, when the broker or the
clients use MQTT 5. The broker must support MQTT 5.\n\nInput: the body is the
payload, as text or bytes. It is turned into bytes, and the `Content-Type`
header is set to `application/octet-stream`, before it is sent. Turn structured
data such as a Map into JS [...]
"group" : "MQTT v5",
"namespace" : "Messaging",
"provider" : "Apache Software Foundation"
@@ -1725,7 +1725,7 @@
"supportLevel" : "Stable",
"title" : "Pulsar Sink",
"summary" : "Sends each message to a topic in Apache Pulsar, named by its
tenant, namespace and topic name.",
- "description" : "Sends each message to a topic in Apache Pulsar, named by
its tenant, namespace and topic name.\n\nUse it to publish events or data for
other applications to read from Pulsar, such as orders or sensor readings. Use
`pulsar-source` to read them.\n\nInput: the body is the payload, as text or
bytes. A Map fails: turn it into JSON text first, for example with
`json-serialize-action`. The headers of the message are not sent as Pulsar
properties; to set properties, put a Ma [...]
+ "description" : "Sends each message to a topic in Apache Pulsar, named by
its tenant, namespace and topic name.\n\nUse it to publish events or data for
other applications to read from Pulsar, such as orders or sensor readings. Use
`pulsar-source` to read them.\n\nInput: the body is the payload, as text or
bytes. It is turned into bytes, and the `Content-Type` header is set to
`application/octet-stream`, before it is sent. A Map fails: turn it into JSON
text first, for example with `j [...]
"group" : "Pulsar",
"namespace" : "Messaging",
"provider" : "Apache Software Foundation"
@@ -2165,7 +2165,7 @@
"supportLevel" : "Stable",
"title" : "Value to Key Action",
"summary" : "Sets the key of the Kafka record to some fields of the JSON
body, so that records with the same values in those fields get the same key.",
- "description" : "Sets the key of the Kafka record to some fields of the
JSON body, so that records with the same values in those fields get the same
key.\n\nUse it to take the key of the record from the data, before
`kafka-sink`, for example the customer of an order, so that all the records of
one customer go to the same partition and stay in order. To take the key from a
header instead use `set-kafka-key-action`.\n\nInput: a JSON object as JSON
text, with the `Content-Type` header s [...]
+ "description" : "Sets the key of the Kafka record to some fields of the
JSON body, so that records with the same values in those fields get the same
key.\n\nUse it to take the key of the record from the data, before
`kafka-sink`, for example the customer of an order, so that all the records of
one customer go to the same partition and stay in order. To take the key from a
header instead use `set-kafka-key-action`.\n\nInput: a JSON object as JSON
text, with the `Content-Type` header s [...]
"group" : "Actions",
"namespace" : "Kafka",
"provider" : "Apache Software Foundation"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/kafka-batch-source.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/kafka-batch-source.kamelet.yaml
index 998eb6626..76a1a947b 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/kafka-batch-source.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/kafka-batch-source.kamelet.yaml
@@ -35,7 +35,7 @@ spec:
Use it to handle many records at once, for example to write them to a
database in one go, or to save the position in Kafka only once a whole batch
was handled. To handle one record at a time use `kafka-source`.
- Output: the body is a List with one entry per record, up to `batchSize`.
Each entry is a message of its own, with the value of the record as its body
(text), and the key, offset and timestamp of the record in its `CamelKafkaKey`,
`CamelKafkaOffset` and `CamelKafkaTimestamp` headers. The record headers are in
the entries too, as bytes. The message itself has the `CamelKafkaTopic` and
`CamelKafkaPartition` headers. The `kafka-topic`, `kafka-key` and other headers
of `kafka-source` ar [...]
+ Output: the body is a List with one entry per record, up to `batchSize`.
Each entry is a Camel `Exchange` for one record, not a message: a step reads
the value of the record, as text, with `getMessage().getBody()` on the entry,
such as `${body[0].getMessage().getBody()}`. The message of the entry also has
the key, offset and timestamp of the record in its `CamelKafkaKey`,
`CamelKafkaOffset` and `CamelKafkaTimestamp` headers, and the record headers,
as bytes. The message itself has [...]
Good to know: `saslAuthType` has no default and must be set; `NONE`
connects with no login and no TLS. To save the position in Kafka only once a
batch was handled, set `allowManualCommit` to true and `autoCommitEnable` to
false, and end the flow with `kafka-batch-manual-commit-action`. A new consumer
group starts at the newest records, unless `autoOffsetReset` is `earliest`.
Without `consumerGroup`, every start uses a new group, so the records sent
while the integration was stopped [...]
required:
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/message-timestamp-router-action.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/message-timestamp-router-action.kamelet.yaml
index 1c3da8f03..0bafd59bb 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/message-timestamp-router-action.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/message-timestamp-router-action.kamelet.yaml
@@ -37,7 +37,7 @@ spec:
Input: a JSON object as JSON text, with the `Content-Type` header set to
`application/json`. The name of the topic is read from the `CamelKafkaTopic`
header, which `kafka-source` sets.
- Output: the same JSON object, as JSON text in a stream, with
`Content-Type` set to `application/json`. When one of the `timestampKeys`
fields is found, the `CamelKafkaOverrideTopic` header is set to the new name,
and `kafka-sink` writes the record to that topic instead of its own `topic`.
+ Output: the same JSON object, as JSON text in bytes, with `Content-Type`
set to `application/json`. When one of the `timestampKeys` fields is found, the
`CamelKafkaOverrideTopic` header is set to the new name, and `kafka-sink`
writes the record to that topic instead of its own `topic`.
Good to know: a field value that cannot be read as a date with
`timestampKeyFormat` makes the message fail. The default `topicFormat` of
`topic-$[timestamp]` gives names such as `topic-20240703`, without the original
name: set it to `$[topic]-$[timestamp]` to keep it. The date is in UTC.
required:
@@ -79,6 +79,12 @@ spec:
description: "Must be `application/json`."
type: string
out:
+ default: json
+ types:
+ json:
+ format: "application-json"
+ description: "The same JSON object, as JSON text in bytes."
+ mediaType: application/json
headers:
CamelKafkaOverrideTopic:
title: Kafka Override Topic
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/mqtt5-sink.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/mqtt5-sink.kamelet.yaml
index e057411c4..dc0bb87c5 100644
--- a/library/camel-kamelets/src/main/resources/kamelets/mqtt5-sink.kamelet.yaml
+++ b/library/camel-kamelets/src/main/resources/kamelets/mqtt5-sink.kamelet.yaml
@@ -35,9 +35,9 @@ spec:
Use it to send commands or data to IoT devices, or to publish readings
and events, when the broker or the clients use MQTT 5. The broker must support
MQTT 5.
- Input: the body is the payload, as text or bytes, and is sent as it is.
Turn structured data such as a Map into JSON text first, for example with
`json-serialize-action`. The headers of the message are not sent, not even as
MQTT 5 user properties.
+ Input: the body is the payload, as text or bytes. It is turned into
bytes, and the `Content-Type` header is set to `application/octet-stream`,
before it is sent. Turn structured data such as a Map into JSON text first, for
example with `json-serialize-action`. The headers of the message are not sent,
not even as MQTT 5 user properties.
- Output: the message is unchanged.
+ Output: the body is the payload, as bytes, and the `Content-Type` header
is `application/octet-stream`. The other headers are kept.
Good to know: messages are published with quality of service 2 (exactly
once) unless `qos` is set, and the broker does not keep them for clients that
subscribe later unless `retained` is true. It connects with no TLS unless
`brokerUrl` starts with `ssl://`. With TLS it checks the certificate and the
host name of the broker, and trusts the certificate authorities that Java
trusts by default, or instead the ones in `sslTruststoreLocation`. It connects
when the integration starts, and [...]
required:
@@ -90,6 +90,14 @@ spec:
format: password
x-descriptors:
- urn:camel:group:credentials
+ dataTypes:
+ in:
+ default: binary
+ types:
+ binary:
+ format: "application-octet-stream"
+ description: "The payload to publish, as bytes."
+ mediaType: application/octet-stream
dependencies:
- "camel:paho-mqtt5"
- "camel:kamelet"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/pulsar-sink.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/pulsar-sink.kamelet.yaml
index a89fb7fb4..60600f338 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/pulsar-sink.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/pulsar-sink.kamelet.yaml
@@ -30,6 +30,12 @@ metadata:
spec:
dataTypes:
in:
+ default: binary
+ types:
+ binary:
+ format: "application-octet-stream"
+ description: "The payload to send, as bytes."
+ mediaType: application/octet-stream
headers:
key:
title: "Message Key"
@@ -53,9 +59,9 @@ spec:
Use it to publish events or data for other applications to read from
Pulsar, such as orders or sensor readings. Use `pulsar-source` to read them.
- Input: the body is the payload, as text or bytes. A Map fails: turn it
into JSON text first, for example with `json-serialize-action`. The headers of
the message are not sent as Pulsar properties; to set properties, put a Map in
the `CamelPulsarProducerMessageProperties` header. The optional `key` header
becomes the key of the message, as the `key` header that `pulsar-source` sets;
the `CamelPulsarProducerMessageKey` header takes precedence over it.
+ Input: the body is the payload, as text or bytes. It is turned into
bytes, and the `Content-Type` header is set to `application/octet-stream`,
before it is sent. A Map fails: turn it into JSON text first, for example with
`json-serialize-action`. The headers of the message are not sent as Pulsar
properties; to set properties, put a Map in the
`CamelPulsarProducerMessageProperties` header. The optional `key` header
becomes the key of the message, as the `key` header that `pulsar-sou [...]
- Output: the message is unchanged.
+ Output: the body is the payload, as bytes, and the `Content-Type` header
is `application/octet-stream`. The other headers are kept.
Good to know: it connects with no TLS and no login, unless `serviceUrl`
starts with `pulsar+ssl://` and `authenticationClass` is set. Over TLS, the
certificate of Pulsar must be signed by an authority that the Java trust store
of the integration trusts, or by one in the PEM file of
`tlsTrustCertsFilePath`, such as a private one, and it must be issued for the
host name in `serviceUrl`. It connects when the integration starts, and the
integration fails to start when Pulsar cannot be [...]
required:
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/value-to-key-action.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/value-to-key-action.kamelet.yaml
index e9181894c..d0cb68c9a 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/value-to-key-action.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/value-to-key-action.kamelet.yaml
@@ -37,7 +37,7 @@ spec:
Input: a JSON object as JSON text, with the `Content-Type` header set to
`application/json`.
- Output: the same JSON object, as JSON text in a stream, with
`Content-Type` set to `application/json`. The `CamelKafkaKey` header, which
`kafka-sink` uses as the key of the record, is set to a Map of the fields named
in `fields` and their values.
+ Output: the same JSON object, as JSON text in bytes, with `Content-Type`
set to `application/json`. The `CamelKafkaKey` header, which `kafka-sink` uses
as the key of the record, is set to a Map of the fields named in `fields` and
their values.
Good to know: `kafka-sink` writes the key as text such as `{id=7,
customer=acme}`, not as JSON, and not necessarily with the fields in the order
of `fields`. A field that is not in the body is left out of the key.
required:
@@ -57,6 +57,12 @@ spec:
description: "Must be `application/json`."
type: string
out:
+ default: json
+ types:
+ json:
+ format: "application-json"
+ description: "The same JSON object, as JSON text in bytes."
+ mediaType: application/json
headers:
CamelKafkaKey:
title: Kafka Key
diff --git
a/tests/camel-kamelets-itest/src/test/resources/kafkarouter/message-timestamp-router-action-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/kafkarouter/message-timestamp-router-action-route.citrus.it.yaml
index 94905742f..2a6cc4e16 100644
---
a/tests/camel-kamelets-itest/src/test/resources/kafkarouter/message-timestamp-router-action-route.citrus.it.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/kafkarouter/message-timestamp-router-action-route.citrus.it.yaml
@@ -39,7 +39,7 @@ actions:
- name: "X-Topic"
value: 'orders-20240703'
- name: "X-Body-Type"
- value: 'org.apache.camel.converter.stream.InputStreamCache'
+ value: '[B'
- name: "X-Content-Type"
value: 'ct=application/json'
body:
diff --git
a/tests/camel-kamelets-itest/src/test/resources/kafkarouter/value-to-key-action-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/kafkarouter/value-to-key-action-route.citrus.it.yaml
index 4ca48532b..b4a64bc2d 100644
---
a/tests/camel-kamelets-itest/src/test/resources/kafkarouter/value-to-key-action-route.citrus.it.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/kafkarouter/value-to-key-action-route.citrus.it.yaml
@@ -39,7 +39,7 @@ actions:
- name: "X-Kafka-Key"
value: '{id=7}'
- name: "X-Body-Type"
- value: 'org.apache.camel.converter.stream.InputStreamCache'
+ value: '[B'
- name: "X-Content-Type"
value: 'ct=application/json'
body:
diff --git
a/tests/camel-kamelets-itest/src/test/resources/pulsar/pulsar-sink-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/pulsar/pulsar-sink-route.citrus.it.yaml
index ead098216..af42fe7c7 100644
---
a/tests/camel-kamelets-itest/src/test/resources/pulsar/pulsar-sink-route.citrus.it.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/pulsar/pulsar-sink-route.citrus.it.yaml
@@ -46,22 +46,21 @@ actions:
- name: "pulsar.service.url"
value:
"pulsar://${CITRUS_TESTCONTAINERS_PULSAR_HOST}:${CITRUS_TESTCONTAINERS_PULSAR_PORT}"
- # The message goes on unchanged after the Kamelet
+ # After the Kamelet the body is the payload as bytes, with Content-Type
application/octet-stream
- http:
server: "httpServer"
receiveRequest:
POST:
path: "/result"
- type: "plaintext"
headers:
- name: "X-Body-Type"
- value: 'java.lang.String'
+ value: '[B'
+ - name: "X-Body"
+ value: 'Hello Pulsar'
- name: "X-Content-Type"
- value: 'ct='
+ value: 'ct=application/octet-stream'
- name: "key"
value: 'order-1'
- body:
- data: 'Hello Pulsar'
- http:
server: "httpServer"
sendResponse:
diff --git
a/tests/camel-kamelets-itest/src/test/resources/pulsar/pulsar-sink-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/pulsar/pulsar-sink-route.yaml
index fb11f9614..4ca6a7e08 100644
---
a/tests/camel-kamelets-itest/src/test/resources/pulsar/pulsar-sink-route.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/pulsar/pulsar-sink-route.yaml
@@ -41,6 +41,9 @@
- setHeader:
name: X-Body-Type
simple: "${body.getClass().getName()}"
+ - setHeader:
+ name: X-Body
+ simple: "${bodyAs(String)}"
- setHeader:
name: X-Content-Type
simple: "ct=${header.Content-Type}"