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 71f65d251 chore: default data types on the Azure and Google Cloud
Kamelets (#3117) (#3301)
71f65d251 is described below
commit 71f65d2515d12030b1bdb636e501978f8e4102c4
Author: Claus Ibsen <[email protected]>
AuthorDate: Fri Nov 20 21:22:26 2026 +0100
chore: default data types on the Azure and Google Cloud Kamelets (#3117)
(#3301)
* chore: default data types on the Azure and Google Cloud Kamelets (#3117)
Batch 2 of #3117:
- azure-servicebus-source and google-pubsub-source: out binary.
- azure-cosmosdb-sink and google-bigquery-sink: in json, so a Map (and
for BigQuery a List of Maps) is now written as JSON and accepted.
- azure-storage-queue-sink: in text.
google-vertexai-sink gets no default: text would break a List for
generateEmbeddings, a Map for rawPredict and a file body for
generateMultimodal. The YAML comment says so.
The Input:/Output: paragraphs and the Citrus expectations are updated.
The Pub/Sub source test also checks that a Content-Type attribute stays
only in CamelGooglePubsubAttributes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
* chore: google-vertexai-sink says which operations take a List, a Map or a
file (#3117)
The Input: paragraph now says that generateEmbeddings takes a List of
texts, that generateMultimodal takes the prompt in the header and a file
as the media, and that rawPredict takes a Map as the JSON request. These
are the inputs a text default would have broken.
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]>
---
kamelets/azure-cosmosdb-sink.kamelet.yaml | 10 ++++++++--
kamelets/azure-servicebus-source.kamelet.yaml | 8 +++++++-
kamelets/azure-storage-queue-sink.kamelet.yaml | 10 ++++++++--
kamelets/google-bigquery-sink.kamelet.yaml | 12 ++++++++++--
kamelets/google-pubsub-source.kamelet.yaml | 8 +++++++-
kamelets/google-vertexai-sink.kamelet.yaml | 7 ++++++-
.../src/main/resources/META-INF/kamelets-index.json | 12 ++++++------
.../main/resources/kamelets/azure-cosmosdb-sink.kamelet.yaml | 10 ++++++++--
.../resources/kamelets/azure-servicebus-source.kamelet.yaml | 8 +++++++-
.../resources/kamelets/azure-storage-queue-sink.kamelet.yaml | 10 ++++++++--
.../resources/kamelets/google-bigquery-sink.kamelet.yaml | 12 ++++++++++--
.../resources/kamelets/google-pubsub-source.kamelet.yaml | 8 +++++++-
.../resources/kamelets/google-vertexai-sink.kamelet.yaml | 7 ++++++-
.../resources/azure/azure-cosmosdb-sink-route.citrus.it.yaml | 4 ++--
.../azure/azure-servicebus-source-route.citrus.it.yaml | 4 ++--
.../test/resources/azure/azure-servicebus-source-route.yaml | 4 +++-
.../azure/azure-storage-queue-sink-route.citrus.it.yaml | 4 ++--
.../google/google-bigquery-sink-route.citrus.it.yaml | 4 ++--
.../google/google-pubsub-source-route.citrus.it.yaml | 12 +++++++-----
.../test/resources/google/google-pubsub-source-route.yaml | 4 +++-
20 files changed, 119 insertions(+), 39 deletions(-)
diff --git a/kamelets/azure-cosmosdb-sink.kamelet.yaml
b/kamelets/azure-cosmosdb-sink.kamelet.yaml
index cfdb206a3..b32c00808 100644
--- a/kamelets/azure-cosmosdb-sink.kamelet.yaml
+++ b/kamelets/azure-cosmosdb-sink.kamelet.yaml
@@ -37,9 +37,9 @@ spec:
Use it to store orders, events or profiles as JSON documents in Cosmos
DB. To receive the changes made to a container, use `azure-cosmosdb-source`.
- Input: the body is one item as JSON text: a JSON object with an `id`
field, such as `{"id": "1001", "region": "EU"}`. A Map fails: turn it into JSON
text first, for example with `json-serialize-action`. The partition key value
of the item comes from the `itemPartitionKey` option or, when the option is not
set, from the `itemPartitionKey` header (or `ce-itemPartitionKey`) of each
message.
+ Input: the body is one item: a JSON object with an `id` field, such as
`{"id": "1001", "region": "EU"}`, as JSON text, or as a Map, which is written
as JSON. Text that is not a JSON object, and a List, fail. The partition key
value of the item comes from the `itemPartitionKey` option or, when the option
is not set, from the `itemPartitionKey` header (or `ce-itemPartitionKey`) of
each message.
- Output: the body afterwards is the item as it was created, as a Map,
with the fields that Cosmos DB adds.
+ Output: the body afterwards is the item as it was created, as a Map,
with the fields that Cosmos DB adds, and the `Content-Type` header is
`application/json`.
Good to know: a message without a partition key value fails. With
`operation` `createItem`, the default, an item whose `id` already exists in the
same partition fails; with `upsertItem`, it replaces the existing item. The
database and the container must exist, unless `createDatabaseIfNotExists` and
`createContainerIfNotExists` are true; a new container needs
`containerPartitionKeyPath`. Headers that start with `CamelAzureCosmosDb` are
removed from the message first, so they cannot [...]
required:
@@ -106,6 +106,12 @@ spec:
mediaType: application/json
dataTypes:
in:
+ default: json
+ types:
+ json:
+ format: "application-json"
+ description: "The item, a JSON object, as JSON text in bytes."
+ mediaType: application/json
headers:
itemPartitionKey:
title: Item Partition Key
diff --git a/kamelets/azure-servicebus-source.kamelet.yaml
b/kamelets/azure-servicebus-source.kamelet.yaml
index d0667b43f..abc2bf57f 100644
--- a/kamelets/azure-servicebus-source.kamelet.yaml
+++ b/kamelets/azure-servicebus-source.kamelet.yaml
@@ -37,7 +37,7 @@ spec:
Use it to process work or events that other applications send through
Service Bus, one at a time or several at once, including a queue with sessions,
or to read the messages that Service Bus has dead-lettered. To read new blobs
from Event Grid events that arrive in a Service Bus queue, use
`azure-storage-blob-event-based-source`.
- Output: the body is the body of the Service Bus message, as bytes. The
headers give its ID (`CamelAzureServiceBusMessageId`), its custom properties
(`CamelAzureServiceBusApplicationProperties`, a Map), its content type,
correlation ID, subject, enqueued time and delivery count, its session ID
(`CamelAzureServiceBusSessionId`) when it was sent with one, and, for a
dead-lettered message, why it was dead-lettered
(`CamelAzureServiceBusDeadLetterReason` and `CamelAzureServiceBusDeadLet [...]
+ Output: the body is the body of the Service Bus message, as bytes, and
the `Content-Type` header is `application/octet-stream`. The headers give its
ID (`CamelAzureServiceBusMessageId`), its custom properties
(`CamelAzureServiceBusApplicationProperties`, a Map), the content type that the
sender set (`CamelAzureServiceBusContentType`), its correlation ID, subject,
enqueued time and delivery count, its session ID
(`CamelAzureServiceBusSessionId`) when it was sent with one, and, for a [...]
Good to know: with the default `serviceBusReceiveMode` of `PEEK_LOCK`, a
message is removed only once it has been processed; a message whose processing
fails is given back and received again, until Service Bus moves it to the
dead-letter queue after the maximum delivery count (10 by default). With
`enableDeadLettering` set to `true`, it is moved to the dead-letter queue
straight away instead, with the exception as the reason, such as
`java.lang.IllegalStateException: Invalid order` [...]
@@ -123,6 +123,12 @@ spec:
mediaType: application/octet-stream
dataTypes:
out:
+ default: binary
+ types:
+ binary:
+ format: "application-octet-stream"
+ description: "The body of the Service Bus message, as bytes."
+ mediaType: application/octet-stream
headers:
CamelAzureServiceBusMessageId:
title: Message ID
diff --git a/kamelets/azure-storage-queue-sink.kamelet.yaml
b/kamelets/azure-storage-queue-sink.kamelet.yaml
index 126bab3ec..6892f8625 100644
--- a/kamelets/azure-storage-queue-sink.kamelet.yaml
+++ b/kamelets/azure-storage-queue-sink.kamelet.yaml
@@ -37,9 +37,9 @@ spec:
Use it to hand work to another application or worker that reads the
queue, such as orders to process or jobs to run. For a message broker with
topics and dead-letter queues, use `azure-servicebus-sink`.
- Input: the body is the text of the queue message: text or bytes. A Map
is sent as its text form, so turn it into JSON text first, for example with
`json-serialize-action`. The optional `expiration` header (or `ce-expiration`)
sets how long the message stays in the queue, as an ISO-8601 duration such as
`PT1H` (one hour) or `P2D` (two days); without it, the message expires after 7
days.
+ Input: the body is the text of the queue message: text, or bytes or a
stream, which are read as UTF-8 text. A Map is sent as its text form, so turn
it into JSON text first, for example with `json-serialize-action`. The optional
`expiration` header (or `ce-expiration`) sets how long the message stays in the
queue, as an ISO-8601 duration such as `PT1H` (one hour) or `P2D` (two days);
without it, the message expires after 7 days.
- Output: the body afterwards is `true`, and headers such as
`CamelAzureStorageQueueMessageId` and `CamelAzureStorageQueueExpirationTime`
describe the message sent.
+ Output: the body afterwards is `true`, the `Content-Type` header is
`text/plain`, and headers such as `CamelAzureStorageQueueMessageId` and
`CamelAzureStorageQueueExpirationTime` describe the message sent.
Good to know: the queue must exist, or a message fails, unless
`createQueue` is true. A message can be held back for a while before readers
see it, with `visibilityTimeout`. An `expiration` that is a plain number, such
as `600`, fails the message. Headers that start with `CamelAzureStorageQueue`
are removed from the message first, so they cannot change what the Kamelet does.
required:
@@ -85,6 +85,12 @@ spec:
pattern: "^P(\\d+D)?(T(\\d+H)?(\\d+M)?(\\d+(\\.\\d+)?S)?)?$"
dataTypes:
in:
+ default: text
+ types:
+ text:
+ format: "text-plain"
+ description: "The text of the queue message."
+ mediaType: text/plain
headers:
expiration:
title: Expiration
diff --git a/kamelets/google-bigquery-sink.kamelet.yaml
b/kamelets/google-bigquery-sink.kamelet.yaml
index ffda2ac2d..986dbe525 100644
--- a/kamelets/google-bigquery-sink.kamelet.yaml
+++ b/kamelets/google-bigquery-sink.kamelet.yaml
@@ -36,9 +36,9 @@ spec:
Use it to load events or records into BigQuery for analytics and
reports, such as orders, page views or sensor readings, as they happen.
- Input: the body is JSON text: a JSON object for one row, or a JSON array
of objects for several rows. The names of the fields are the names of the
columns of the table, such as `{"id": 1, "item": "book"}`.
+ Input: the body is a JSON object for one row, or a JSON array of objects
for several rows, as JSON text, or as a Map or a List of Maps, which is written
as JSON. The names of the fields are the names of the columns of the table,
such as `{"id": 1, "item": "book"}`.
- Output: when it is used inside a route, the body afterwards is the
parsed JSON: a Map for one row, or a List of Maps.
+ Output: when it is used inside a route, the body afterwards is the
parsed JSON: a Map for one row, or a List of Maps, and the `Content-Type`
header is `application/json`.
Good to know: the table must exist with its columns. A message with a
field that is not a column of the table, or with a body that is not JSON,
fails, and none of its rows are inserted. Headers that start with
`CamelGoogleBigQuery` are removed from the message first, so they cannot change
what the Kamelet does. A message that is sent again, for example after a
failure, adds its rows again, unless `useAsInsertId` names a field that
identifies each row.
required:
@@ -79,6 +79,14 @@ spec:
types:
in:
mediaType: application/json
+ dataTypes:
+ in:
+ default: json
+ types:
+ json:
+ format: "application-json"
+ description: "The rows, a JSON object or a JSON array of objects, as
JSON text in bytes."
+ mediaType: application/json
dependencies:
- "camel:kamelet"
- "camel:google-bigquery"
diff --git a/kamelets/google-pubsub-source.kamelet.yaml
b/kamelets/google-pubsub-source.kamelet.yaml
index bc9262095..7b6bd819f 100644
--- a/kamelets/google-pubsub-source.kamelet.yaml
+++ b/kamelets/google-pubsub-source.kamelet.yaml
@@ -36,7 +36,7 @@ spec:
Use it to react to events that other applications publish to a Pub/Sub
topic, such as orders, uploads or alerts. To publish messages, use
`google-pubsub-sink`. To react to new files in a Cloud Storage bucket through
Pub/Sub notifications, use `google-storage-event-based-source`.
- Output: the body is the data of the Pub/Sub message, as bytes. The
`CamelGooglePubsubMessageId` and `CamelGooglePubsubPublishTime` headers give
the ID and the publish time of the message, `CamelGooglePubsubAttributes` gives
its attributes as a Map, and each attribute is also set as a header of its own.
+ Output: the body is the data of the Pub/Sub message, as bytes, and the
`Content-Type` header is `application/octet-stream`. The
`CamelGooglePubsubMessageId` and `CamelGooglePubsubPublishTime` headers give
the ID and the publish time of the message, `CamelGooglePubsubAttributes` gives
its attributes as a Map, and each attribute is also set as a header of its own,
except a `Content-Type` attribute, which is only in
`CamelGooglePubsubAttributes`.
Good to know: the subscription must already exist; for one that does
not, it logs an error and receives nothing. A message whose processing fails is
not acknowledged, so Pub/Sub delivers it again. With `ackMode` `NONE`, the
route acknowledges each message itself, through the
`CamelGooglePubsubAcknowledge` header. On a subscription with a dead-letter
topic, `maxDeliveryAttempts` stops a message that keeps failing from being
processed again. Without `serviceAccountKey`, it logs in wi [...]
required:
@@ -93,6 +93,12 @@ spec:
example: 600
dataTypes:
out:
+ default: binary
+ types:
+ binary:
+ format: "application-octet-stream"
+ description: "The data of the Pub/Sub message, as bytes."
+ mediaType: application/octet-stream
headers:
CamelGooglePubsubMessageId:
title: Message ID
diff --git a/kamelets/google-vertexai-sink.kamelet.yaml
b/kamelets/google-vertexai-sink.kamelet.yaml
index 57461dee4..394e1964a 100644
--- a/kamelets/google-vertexai-sink.kamelet.yaml
+++ b/kamelets/google-vertexai-sink.kamelet.yaml
@@ -35,7 +35,7 @@ spec:
Use it to summarize, classify, translate or answer questions about text
as it flows, for example to summarize support tickets or extract the topic of
an email. To call a partner model of the Model Garden instead, such as Claude
of Anthropic, set `operation` to `rawPredict` and `publisher`.
- Input: the body is the prompt, as text; bytes and streams are read as
text. The optional `CamelGoogleVertexAIPrompt` header gives the prompt instead
of the body. With `rawPredict`, the header is not used: the body is the prompt
as text, or a JSON request in the format of the publisher, such as the Messages
API of Anthropic, which is sent as it is, with `anthropic_version` added for
Anthropic.
+ Input: the body is the prompt, as text; bytes and streams are read as
text. The optional `CamelGoogleVertexAIPrompt` header gives the prompt instead
of the body. With `generateEmbeddings`, the body can also be a List of texts,
which gives one vector per text. With `generateMultimodal`, the prompt is in
the `CamelGoogleVertexAIPrompt` header and the body is a file, sent as the
media, whose type comes from the extension of its name, such as `.png`. With
`rawPredict`, the header is no [...]
Output: when it is used inside a route, the body afterwards is the
answer of the model, as text, for the default `generateText` operation; with
`jsonMode` set to true, it is JSON text. The `CamelGoogleVertexAIFinishReason`
header says why the model stopped, and the token counts are in the
`CamelGoogleVertexAIPromptTokenCount`,
`CamelGoogleVertexAICandidatesTokenCount` and
`CamelGoogleVertexAITotalTokenCount` headers. With `rawPredict` and the
publisher `anthropic`, the body afterwa [...]
@@ -111,6 +111,11 @@ spec:
description: If true, the model is asked to answer with JSON (the
response type `application/json`), so the body afterwards is JSON text. Say in
the prompt which fields you want. Only used with `generateText`,
`generateChat`, `generateCode` and `generateMultimodal`. When it is not set, it
is false.
type: boolean
dataTypes:
+ # No 'default:' here on purpose. A text-plain default would turn every
+ # body into text at the start of the Kamelet, but not every operation
+ # takes text: generateEmbeddings gives one vector per element of a List,
+ # generateMultimodal sends a file body as the media, and rawPredict
+ # writes a Map as the JSON request. See #3117.
in:
headers:
CamelGoogleVertexAIPrompt:
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 72db3aaf2..d1c58f662 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
@@ -335,7 +335,7 @@
"supportLevel" : "Stable",
"title" : "Azure CosmosDB Sink",
"summary" : "Creates or replaces an item (a JSON document) in a container
of Azure Cosmos DB for each message, from the JSON object in the body.",
- "description" : "Creates or replaces an item (a JSON document) in a
container of Azure Cosmos DB for each message, from the JSON object in the
body.\n\nUse it to store orders, events or profiles as JSON documents in Cosmos
DB. To receive the changes made to a container, use
`azure-cosmosdb-source`.\n\nInput: the body is one item as JSON text: a JSON
object with an `id` field, such as `{\"id\": \"1001\", \"region\": \"EU\"}`. A
Map fails: turn it into JSON text first, for example with [...]
+ "description" : "Creates or replaces an item (a JSON document) in a
container of Azure Cosmos DB for each message, from the JSON object in the
body.\n\nUse it to store orders, events or profiles as JSON documents in Cosmos
DB. To receive the changes made to a container, use
`azure-cosmosdb-source`.\n\nInput: the body is one item: a JSON object with an
`id` field, such as `{\"id\": \"1001\", \"region\": \"EU\"}`, as JSON text, or
as a Map, which is written as JSON. Text that is not a [...]
"group" : "Azure CosmosDB",
"namespace" : "Azure",
"provider" : "Apache Software Foundation"
@@ -395,7 +395,7 @@
"supportLevel" : "Stable",
"title" : "Azure Servicebus Source",
"summary" : "Receives the messages of a queue, or of a topic subscription,
in Azure Service Bus, one message each.",
- "description" : "Receives the messages of a queue, or of a topic
subscription, in Azure Service Bus, one message each.\n\nUse it to process work
or events that other applications send through Service Bus, one at a time or
several at once, including a queue with sessions, or to read the messages that
Service Bus has dead-lettered. To read new blobs from Event Grid events that
arrive in a Service Bus queue, use
`azure-storage-blob-event-based-source`.\n\nOutput: the body is the body of
[...]
+ "description" : "Receives the messages of a queue, or of a topic
subscription, in Azure Service Bus, one message each.\n\nUse it to process work
or events that other applications send through Service Bus, one at a time or
several at once, including a queue with sessions, or to read the messages that
Service Bus has dead-lettered. To read new blobs from Event Grid events that
arrive in a Service Bus queue, use
`azure-storage-blob-event-based-source`.\n\nOutput: the body is the body of
[...]
"group" : "Azure Servicebus",
"namespace" : "Azure",
"provider" : "Apache Software Foundation"
@@ -485,7 +485,7 @@
"supportLevel" : "Stable",
"title" : "Azure Storage Queue Sink",
"summary" : "Adds each message to a queue in Azure Queue Storage, as the
text of a queue message.",
- "description" : "Adds each message to a queue in Azure Queue Storage, as
the text of a queue message.\n\nUse it to hand work to another application or
worker that reads the queue, such as orders to process or jobs to run. For a
message broker with topics and dead-letter queues, use
`azure-servicebus-sink`.\n\nInput: the body is the text of the queue message:
text or bytes. A Map is sent as its text form, so turn it into JSON text first,
for example with `json-serialize-action`. The o [...]
+ "description" : "Adds each message to a queue in Azure Queue Storage, as
the text of a queue message.\n\nUse it to hand work to another application or
worker that reads the queue, such as orders to process or jobs to run. For a
message broker with topics and dead-letter queues, use
`azure-servicebus-sink`.\n\nInput: the body is the text of the queue message:
text, or bytes or a stream, which are read as UTF-8 text. A Map is sent as its
text form, so turn it into JSON text first, for [...]
"group" : "Azure Storage Queue",
"namespace" : "Azure",
"provider" : "Apache Software Foundation"
@@ -875,7 +875,7 @@
"supportLevel" : "Stable",
"title" : "Google Big Query Sink",
"summary" : "Inserts each message as one or more rows into a table in
Google BigQuery.",
- "description" : "Inserts each message as one or more rows into a table in
Google BigQuery.\n\nUse it to load events or records into BigQuery for
analytics and reports, such as orders, page views or sensor readings, as they
happen.\n\nInput: the body is JSON text: a JSON object for one row, or a JSON
array of objects for several rows. The names of the fields are the names of the
columns of the table, such as `{\"id\": 1, \"item\": \"book\"}`.\n\nOutput:
when it is used inside a route, [...]
+ "description" : "Inserts each message as one or more rows into a table in
Google BigQuery.\n\nUse it to load events or records into BigQuery for
analytics and reports, such as orders, page views or sensor readings, as they
happen.\n\nInput: the body is a JSON object for one row, or a JSON array of
objects for several rows, as JSON text, or as a Map or a List of Maps, which is
written as JSON. The names of the fields are the names of the columns of the
table, such as `{\"id\": 1, \"it [...]
"group" : "Google Big Query",
"namespace" : "GCP",
"provider" : "Apache Software Foundation"
@@ -915,7 +915,7 @@
"supportLevel" : "Stable",
"title" : "Google Pubsub Source",
"summary" : "Receives the messages of a Google Cloud Pub/Sub subscription,
one message per Pub/Sub message, and acknowledges each one once it has been
processed.",
- "description" : "Receives the messages of a Google Cloud Pub/Sub
subscription, one message per Pub/Sub message, and acknowledges each one once
it has been processed.\n\nUse it to react to events that other applications
publish to a Pub/Sub topic, such as orders, uploads or alerts. To publish
messages, use `google-pubsub-sink`. To react to new files in a Cloud Storage
bucket through Pub/Sub notifications, use
`google-storage-event-based-source`.\n\nOutput: the body is the data of the
[...]
+ "description" : "Receives the messages of a Google Cloud Pub/Sub
subscription, one message per Pub/Sub message, and acknowledges each one once
it has been processed.\n\nUse it to react to events that other applications
publish to a Pub/Sub topic, such as orders, uploads or alerts. To publish
messages, use `google-pubsub-sink`. To react to new files in a Cloud Storage
bucket through Pub/Sub notifications, use
`google-storage-event-based-source`.\n\nOutput: the body is the data of the
[...]
"group" : "Google Pubsub",
"namespace" : "GCP",
"provider" : "Apache Software Foundation"
@@ -975,7 +975,7 @@
"supportLevel" : "Preview",
"title" : "Google Vertex AI Sink",
"summary" : "Sends each message as a prompt to a generative AI model in
Google Vertex AI, such as Gemini, and replaces the body with the answer of the
model.",
- "description" : "Sends each message as a prompt to a generative AI model
in Google Vertex AI, such as Gemini, and replaces the body with the answer of
the model.\n\nUse it to summarize, classify, translate or answer questions
about text as it flows, for example to summarize support tickets or extract the
topic of an email. To call a partner model of the Model Garden instead, such as
Claude of Anthropic, set `operation` to `rawPredict` and `publisher`.\n\nInput:
the body is the prompt [...]
+ "description" : "Sends each message as a prompt to a generative AI model
in Google Vertex AI, such as Gemini, and replaces the body with the answer of
the model.\n\nUse it to summarize, classify, translate or answer questions
about text as it flows, for example to summarize support tickets or extract the
topic of an email. To call a partner model of the Model Garden instead, such as
Claude of Anthropic, set `operation` to `rawPredict` and `publisher`.\n\nInput:
the body is the prompt [...]
"group" : "Google Vertex AI",
"namespace" : "GCP",
"provider" : "Apache Software Foundation"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/azure-cosmosdb-sink.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/azure-cosmosdb-sink.kamelet.yaml
index cfdb206a3..b32c00808 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/azure-cosmosdb-sink.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/azure-cosmosdb-sink.kamelet.yaml
@@ -37,9 +37,9 @@ spec:
Use it to store orders, events or profiles as JSON documents in Cosmos
DB. To receive the changes made to a container, use `azure-cosmosdb-source`.
- Input: the body is one item as JSON text: a JSON object with an `id`
field, such as `{"id": "1001", "region": "EU"}`. A Map fails: turn it into JSON
text first, for example with `json-serialize-action`. The partition key value
of the item comes from the `itemPartitionKey` option or, when the option is not
set, from the `itemPartitionKey` header (or `ce-itemPartitionKey`) of each
message.
+ Input: the body is one item: a JSON object with an `id` field, such as
`{"id": "1001", "region": "EU"}`, as JSON text, or as a Map, which is written
as JSON. Text that is not a JSON object, and a List, fail. The partition key
value of the item comes from the `itemPartitionKey` option or, when the option
is not set, from the `itemPartitionKey` header (or `ce-itemPartitionKey`) of
each message.
- Output: the body afterwards is the item as it was created, as a Map,
with the fields that Cosmos DB adds.
+ Output: the body afterwards is the item as it was created, as a Map,
with the fields that Cosmos DB adds, and the `Content-Type` header is
`application/json`.
Good to know: a message without a partition key value fails. With
`operation` `createItem`, the default, an item whose `id` already exists in the
same partition fails; with `upsertItem`, it replaces the existing item. The
database and the container must exist, unless `createDatabaseIfNotExists` and
`createContainerIfNotExists` are true; a new container needs
`containerPartitionKeyPath`. Headers that start with `CamelAzureCosmosDb` are
removed from the message first, so they cannot [...]
required:
@@ -106,6 +106,12 @@ spec:
mediaType: application/json
dataTypes:
in:
+ default: json
+ types:
+ json:
+ format: "application-json"
+ description: "The item, a JSON object, as JSON text in bytes."
+ mediaType: application/json
headers:
itemPartitionKey:
title: Item Partition Key
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/azure-servicebus-source.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/azure-servicebus-source.kamelet.yaml
index d0667b43f..abc2bf57f 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/azure-servicebus-source.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/azure-servicebus-source.kamelet.yaml
@@ -37,7 +37,7 @@ spec:
Use it to process work or events that other applications send through
Service Bus, one at a time or several at once, including a queue with sessions,
or to read the messages that Service Bus has dead-lettered. To read new blobs
from Event Grid events that arrive in a Service Bus queue, use
`azure-storage-blob-event-based-source`.
- Output: the body is the body of the Service Bus message, as bytes. The
headers give its ID (`CamelAzureServiceBusMessageId`), its custom properties
(`CamelAzureServiceBusApplicationProperties`, a Map), its content type,
correlation ID, subject, enqueued time and delivery count, its session ID
(`CamelAzureServiceBusSessionId`) when it was sent with one, and, for a
dead-lettered message, why it was dead-lettered
(`CamelAzureServiceBusDeadLetterReason` and `CamelAzureServiceBusDeadLet [...]
+ Output: the body is the body of the Service Bus message, as bytes, and
the `Content-Type` header is `application/octet-stream`. The headers give its
ID (`CamelAzureServiceBusMessageId`), its custom properties
(`CamelAzureServiceBusApplicationProperties`, a Map), the content type that the
sender set (`CamelAzureServiceBusContentType`), its correlation ID, subject,
enqueued time and delivery count, its session ID
(`CamelAzureServiceBusSessionId`) when it was sent with one, and, for a [...]
Good to know: with the default `serviceBusReceiveMode` of `PEEK_LOCK`, a
message is removed only once it has been processed; a message whose processing
fails is given back and received again, until Service Bus moves it to the
dead-letter queue after the maximum delivery count (10 by default). With
`enableDeadLettering` set to `true`, it is moved to the dead-letter queue
straight away instead, with the exception as the reason, such as
`java.lang.IllegalStateException: Invalid order` [...]
@@ -123,6 +123,12 @@ spec:
mediaType: application/octet-stream
dataTypes:
out:
+ default: binary
+ types:
+ binary:
+ format: "application-octet-stream"
+ description: "The body of the Service Bus message, as bytes."
+ mediaType: application/octet-stream
headers:
CamelAzureServiceBusMessageId:
title: Message ID
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/azure-storage-queue-sink.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/azure-storage-queue-sink.kamelet.yaml
index 126bab3ec..6892f8625 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/azure-storage-queue-sink.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/azure-storage-queue-sink.kamelet.yaml
@@ -37,9 +37,9 @@ spec:
Use it to hand work to another application or worker that reads the
queue, such as orders to process or jobs to run. For a message broker with
topics and dead-letter queues, use `azure-servicebus-sink`.
- Input: the body is the text of the queue message: text or bytes. A Map
is sent as its text form, so turn it into JSON text first, for example with
`json-serialize-action`. The optional `expiration` header (or `ce-expiration`)
sets how long the message stays in the queue, as an ISO-8601 duration such as
`PT1H` (one hour) or `P2D` (two days); without it, the message expires after 7
days.
+ Input: the body is the text of the queue message: text, or bytes or a
stream, which are read as UTF-8 text. A Map is sent as its text form, so turn
it into JSON text first, for example with `json-serialize-action`. The optional
`expiration` header (or `ce-expiration`) sets how long the message stays in the
queue, as an ISO-8601 duration such as `PT1H` (one hour) or `P2D` (two days);
without it, the message expires after 7 days.
- Output: the body afterwards is `true`, and headers such as
`CamelAzureStorageQueueMessageId` and `CamelAzureStorageQueueExpirationTime`
describe the message sent.
+ Output: the body afterwards is `true`, the `Content-Type` header is
`text/plain`, and headers such as `CamelAzureStorageQueueMessageId` and
`CamelAzureStorageQueueExpirationTime` describe the message sent.
Good to know: the queue must exist, or a message fails, unless
`createQueue` is true. A message can be held back for a while before readers
see it, with `visibilityTimeout`. An `expiration` that is a plain number, such
as `600`, fails the message. Headers that start with `CamelAzureStorageQueue`
are removed from the message first, so they cannot change what the Kamelet does.
required:
@@ -85,6 +85,12 @@ spec:
pattern: "^P(\\d+D)?(T(\\d+H)?(\\d+M)?(\\d+(\\.\\d+)?S)?)?$"
dataTypes:
in:
+ default: text
+ types:
+ text:
+ format: "text-plain"
+ description: "The text of the queue message."
+ mediaType: text/plain
headers:
expiration:
title: Expiration
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/google-bigquery-sink.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/google-bigquery-sink.kamelet.yaml
index ffda2ac2d..986dbe525 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/google-bigquery-sink.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/google-bigquery-sink.kamelet.yaml
@@ -36,9 +36,9 @@ spec:
Use it to load events or records into BigQuery for analytics and
reports, such as orders, page views or sensor readings, as they happen.
- Input: the body is JSON text: a JSON object for one row, or a JSON array
of objects for several rows. The names of the fields are the names of the
columns of the table, such as `{"id": 1, "item": "book"}`.
+ Input: the body is a JSON object for one row, or a JSON array of objects
for several rows, as JSON text, or as a Map or a List of Maps, which is written
as JSON. The names of the fields are the names of the columns of the table,
such as `{"id": 1, "item": "book"}`.
- Output: when it is used inside a route, the body afterwards is the
parsed JSON: a Map for one row, or a List of Maps.
+ Output: when it is used inside a route, the body afterwards is the
parsed JSON: a Map for one row, or a List of Maps, and the `Content-Type`
header is `application/json`.
Good to know: the table must exist with its columns. A message with a
field that is not a column of the table, or with a body that is not JSON,
fails, and none of its rows are inserted. Headers that start with
`CamelGoogleBigQuery` are removed from the message first, so they cannot change
what the Kamelet does. A message that is sent again, for example after a
failure, adds its rows again, unless `useAsInsertId` names a field that
identifies each row.
required:
@@ -79,6 +79,14 @@ spec:
types:
in:
mediaType: application/json
+ dataTypes:
+ in:
+ default: json
+ types:
+ json:
+ format: "application-json"
+ description: "The rows, a JSON object or a JSON array of objects, as
JSON text in bytes."
+ mediaType: application/json
dependencies:
- "camel:kamelet"
- "camel:google-bigquery"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/google-pubsub-source.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/google-pubsub-source.kamelet.yaml
index bc9262095..7b6bd819f 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/google-pubsub-source.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/google-pubsub-source.kamelet.yaml
@@ -36,7 +36,7 @@ spec:
Use it to react to events that other applications publish to a Pub/Sub
topic, such as orders, uploads or alerts. To publish messages, use
`google-pubsub-sink`. To react to new files in a Cloud Storage bucket through
Pub/Sub notifications, use `google-storage-event-based-source`.
- Output: the body is the data of the Pub/Sub message, as bytes. The
`CamelGooglePubsubMessageId` and `CamelGooglePubsubPublishTime` headers give
the ID and the publish time of the message, `CamelGooglePubsubAttributes` gives
its attributes as a Map, and each attribute is also set as a header of its own.
+ Output: the body is the data of the Pub/Sub message, as bytes, and the
`Content-Type` header is `application/octet-stream`. The
`CamelGooglePubsubMessageId` and `CamelGooglePubsubPublishTime` headers give
the ID and the publish time of the message, `CamelGooglePubsubAttributes` gives
its attributes as a Map, and each attribute is also set as a header of its own,
except a `Content-Type` attribute, which is only in
`CamelGooglePubsubAttributes`.
Good to know: the subscription must already exist; for one that does
not, it logs an error and receives nothing. A message whose processing fails is
not acknowledged, so Pub/Sub delivers it again. With `ackMode` `NONE`, the
route acknowledges each message itself, through the
`CamelGooglePubsubAcknowledge` header. On a subscription with a dead-letter
topic, `maxDeliveryAttempts` stops a message that keeps failing from being
processed again. Without `serviceAccountKey`, it logs in wi [...]
required:
@@ -93,6 +93,12 @@ spec:
example: 600
dataTypes:
out:
+ default: binary
+ types:
+ binary:
+ format: "application-octet-stream"
+ description: "The data of the Pub/Sub message, as bytes."
+ mediaType: application/octet-stream
headers:
CamelGooglePubsubMessageId:
title: Message ID
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/google-vertexai-sink.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/google-vertexai-sink.kamelet.yaml
index 57461dee4..394e1964a 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/google-vertexai-sink.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/google-vertexai-sink.kamelet.yaml
@@ -35,7 +35,7 @@ spec:
Use it to summarize, classify, translate or answer questions about text
as it flows, for example to summarize support tickets or extract the topic of
an email. To call a partner model of the Model Garden instead, such as Claude
of Anthropic, set `operation` to `rawPredict` and `publisher`.
- Input: the body is the prompt, as text; bytes and streams are read as
text. The optional `CamelGoogleVertexAIPrompt` header gives the prompt instead
of the body. With `rawPredict`, the header is not used: the body is the prompt
as text, or a JSON request in the format of the publisher, such as the Messages
API of Anthropic, which is sent as it is, with `anthropic_version` added for
Anthropic.
+ Input: the body is the prompt, as text; bytes and streams are read as
text. The optional `CamelGoogleVertexAIPrompt` header gives the prompt instead
of the body. With `generateEmbeddings`, the body can also be a List of texts,
which gives one vector per text. With `generateMultimodal`, the prompt is in
the `CamelGoogleVertexAIPrompt` header and the body is a file, sent as the
media, whose type comes from the extension of its name, such as `.png`. With
`rawPredict`, the header is no [...]
Output: when it is used inside a route, the body afterwards is the
answer of the model, as text, for the default `generateText` operation; with
`jsonMode` set to true, it is JSON text. The `CamelGoogleVertexAIFinishReason`
header says why the model stopped, and the token counts are in the
`CamelGoogleVertexAIPromptTokenCount`,
`CamelGoogleVertexAICandidatesTokenCount` and
`CamelGoogleVertexAITotalTokenCount` headers. With `rawPredict` and the
publisher `anthropic`, the body afterwa [...]
@@ -111,6 +111,11 @@ spec:
description: If true, the model is asked to answer with JSON (the
response type `application/json`), so the body afterwards is JSON text. Say in
the prompt which fields you want. Only used with `generateText`,
`generateChat`, `generateCode` and `generateMultimodal`. When it is not set, it
is false.
type: boolean
dataTypes:
+ # No 'default:' here on purpose. A text-plain default would turn every
+ # body into text at the start of the Kamelet, but not every operation
+ # takes text: generateEmbeddings gives one vector per element of a List,
+ # generateMultimodal sends a file body as the media, and rawPredict
+ # writes a Map as the JSON request. See #3117.
in:
headers:
CamelGoogleVertexAIPrompt:
diff --git
a/tests/camel-kamelets-itest/src/test/resources/azure/azure-cosmosdb-sink-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/azure/azure-cosmosdb-sink-route.citrus.it.yaml
index 985d4792b..f984673ef 100644
---
a/tests/camel-kamelets-itest/src/test/resources/azure/azure-cosmosdb-sink-route.citrus.it.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/azure/azure-cosmosdb-sink-route.citrus.it.yaml
@@ -52,7 +52,7 @@ actions:
resources:
- "AzureCosmosClient.java"
- # Afterwards the body is the item as it was created, as a Map, with the
fields that Cosmos DB adds
+ # Afterwards the body is the item as it was created, as a Map, with the
fields that Cosmos DB adds, and the Content-Type application/json
- http:
server: "azureServer"
receiveRequest:
@@ -63,7 +63,7 @@ actions:
- name: "X-Body-Type"
value: 'java.util.LinkedHashMap'
- name: "X-Content-Type"
- value: 'ct='
+ value: 'ct=application/json'
- name: "X-Status-Code"
value: '201'
body:
diff --git
a/tests/camel-kamelets-itest/src/test/resources/azure/azure-servicebus-source-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/azure/azure-servicebus-source-route.citrus.it.yaml
index cde2ed081..50d8752c2 100644
---
a/tests/camel-kamelets-itest/src/test/resources/azure/azure-servicebus-source-route.citrus.it.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/azure/azure-servicebus-source-route.citrus.it.yaml
@@ -37,7 +37,7 @@ actions:
- name: "servicebus.connectionString"
value: "${servicebus.connectionString}"
- # The body of the message, as bytes, with its ID, delivery count and custom
properties
+ # The body of the message, as bytes with the Content-Type
application/octet-stream, with its ID, delivery count and custom properties
- http:
server: "azureServer"
receiveRequest:
@@ -48,7 +48,7 @@ actions:
- name: "X-Body-Type"
value: '[B'
- name: "X-Content-Type"
- value: 'ct='
+ value: 'ct=application/octet-stream'
- name: "X-Message-Id"
value: '@matches([0-9a-f]{32})@'
- name: "X-Delivery-Count"
diff --git
a/tests/camel-kamelets-itest/src/test/resources/azure/azure-servicebus-source-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/azure/azure-servicebus-source-route.yaml
index 772e8493e..c003e1138 100644
---
a/tests/camel-kamelets-itest/src/test/resources/azure/azure-servicebus-source-route.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/azure/azure-servicebus-source-route.yaml
@@ -55,7 +55,9 @@
- setHeader:
name: X-Properties
simple: "${header.CamelAzureServiceBusApplicationProperties}"
- # the body as text, for the HTTP call
+ # the body as text, for the HTTP call: Citrus reads an
application/octet-stream body as a byte array
+ - removeHeader:
+ name: Content-Type
- convertBodyTo:
type: "java.lang.String"
- to:
diff --git
a/tests/camel-kamelets-itest/src/test/resources/azure/azure-storage-queue-sink-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/azure/azure-storage-queue-sink-route.citrus.it.yaml
index bf026b472..ae321a646 100644
---
a/tests/camel-kamelets-itest/src/test/resources/azure/azure-storage-queue-sink-route.citrus.it.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/azure/azure-storage-queue-sink-route.citrus.it.yaml
@@ -52,7 +52,7 @@ actions:
resources:
- "AzureQueueClient.java"
- # Afterwards the body is true, and the CamelAzureStorageQueueMessageId
header gives the ID of the message
+ # Afterwards the body is true, the Content-Type is text/plain, and the
CamelAzureStorageQueueMessageId header gives the ID of the message
- http:
server: "azureServer"
receiveRequest:
@@ -63,7 +63,7 @@ actions:
- name: "X-Body-Type"
value: 'java.lang.Boolean'
- name: "X-Content-Type"
- value: 'ct='
+ value: 'ct=text/plain'
- name: "X-Message-Id"
value: '@matches([0-9a-f-]{36})@'
body:
diff --git
a/tests/camel-kamelets-itest/src/test/resources/google/google-bigquery-sink-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/google/google-bigquery-sink-route.citrus.it.yaml
index 233c088c4..20f0f4a07 100644
---
a/tests/camel-kamelets-itest/src/test/resources/google/google-bigquery-sink-route.citrus.it.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/google/google-bigquery-sink-route.citrus.it.yaml
@@ -80,7 +80,7 @@ actions:
resources:
- "GoogleBigQueryClient.java"
- # Afterwards the body is the parsed JSON, a List of Maps
+ # Afterwards the body is the parsed JSON, a List of Maps, and the
Content-Type is application/json
- http:
server: "gcpServer"
receiveRequest:
@@ -91,7 +91,7 @@ actions:
- name: "X-Body-Type"
value: 'java.util.ArrayList'
- name: "X-Content-Type"
- value: 'ct='
+ value: 'ct=application/json'
body:
data: '[{id=1, item=book}, {id=2, item=pen}]'
- http:
diff --git
a/tests/camel-kamelets-itest/src/test/resources/google/google-pubsub-source-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/google/google-pubsub-source-route.citrus.it.yaml
index da343acf7..83f27d9e2 100644
---
a/tests/camel-kamelets-itest/src/test/resources/google/google-pubsub-source-route.citrus.it.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/google/google-pubsub-source-route.citrus.it.yaml
@@ -31,7 +31,7 @@ actions:
waitFor:
logMessage: '.*Listening on.*'
- # The topic orders, with the subscription orders-sub, and a message with an
attribute
+ # The topic orders, with the subscription orders-sub, and a message with two
attributes, one of them Content-Type
- http:
client:
"http://${CITRUS_TESTCONTAINERS_GCP_HOST}:${CITRUS_TESTCONTAINERS_GCP_PORT}"
sendRequest:
@@ -67,7 +67,7 @@ actions:
path: "/v1/projects/kamelets/topics/orders:publish"
contentType: "application/json"
body:
- data:
'{"messages":[{"data":"SGVsbG8gUHViL1N1Yg==","attributes":{"origin":"citrus"}}]}'
+ data:
'{"messages":[{"data":"SGVsbG8gUHViL1N1Yg==","attributes":{"origin":"citrus","Content-Type":"text/plain"}}]}'
- http:
client:
"http://${CITRUS_TESTCONTAINERS_GCP_HOST}:${CITRUS_TESTCONTAINERS_GCP_PORT}"
receiveResponse:
@@ -96,7 +96,9 @@ actions:
- name: "camel.component.google-pubsub.authenticate"
value: "false"
- # The data of the message, as bytes, with the attribute in
CamelGooglePubsubAttributes and as the header origin
+ # The data of the message, as bytes with the Content-Type
application/octet-stream, with the attributes in
+ # CamelGooglePubsubAttributes and origin as a header. The Content-Type
attribute is only in CamelGooglePubsubAttributes:
+ # the Content-Type header is the one of the bytes.
- http:
server: "gcpServer"
receiveRequest:
@@ -107,11 +109,11 @@ actions:
- name: "X-Body-Type"
value: '[B'
- name: "X-Content-Type"
- value: 'ct='
+ value: 'ct=application/octet-stream'
- name: "X-Message-Id"
value: '@matches([0-9]+)@'
- name: "X-Attributes"
- value: '{origin=citrus}'
+ value: '@matches(\{.*Content-Type=text/plain.*\})@'
- name: "origin"
value: 'citrus'
body:
diff --git
a/tests/camel-kamelets-itest/src/test/resources/google/google-pubsub-source-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/google/google-pubsub-source-route.yaml
index 6994f4206..ad7be928b 100644
---
a/tests/camel-kamelets-itest/src/test/resources/google/google-pubsub-source-route.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/google/google-pubsub-source-route.yaml
@@ -36,7 +36,9 @@
- setHeader:
name: X-Attributes
simple: "${header.CamelGooglePubsubAttributes}"
- # the body as text, for the HTTP call
+ # the body as text, for the HTTP call: Citrus reads an
application/octet-stream body as a byte array
+ - removeHeader:
+ name: Content-Type
- convertBodyTo:
type: "java.lang.String"
- to: