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.git
commit d957f50b7f7ee366e00c2d52c660d8d8bd9e26c2 Author: Claus Ibsen <[email protected]> AuthorDate: Sat Oct 24 19:57:06 2026 +0200 CAMEL-24961: Catalog body types for the eight alibaba components, dapr and consul (#28409) Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../catalog/components/alibaba-eventbridge.json | 4 + .../camel/catalog/components/alibaba-fc.json | 4 + .../camel/catalog/components/alibaba-kms.json | 4 + .../camel/catalog/components/alibaba-mns.json | 5 ++ .../camel/catalog/components/alibaba-oss.json | 5 ++ .../camel/catalog/components/alibaba-ots.json | 4 + .../camel/catalog/components/alibaba-sls.json | 4 + .../camel/catalog/components/alibaba-sms.json | 4 + .../apache/camel/catalog/components/consul.json | 5 ++ .../org/apache/camel/catalog/components/dapr.json | 5 ++ .../docs/alibaba-eventbridge-component.adoc | 8 +- .../camel/catalog/docs/alibaba-oss-component.adoc | 2 +- .../camel/catalog/docs/alibaba-sls-component.adoc | 2 +- .../camel/catalog/docs/consul-component.adoc | 5 +- .../alibaba/eventbridge/alibaba-eventbridge.json | 4 + .../main/docs/alibaba-eventbridge-component.adoc | 8 +- .../eventbridge/AlibabaEventBridgeEndpoint.java | 15 ++++ .../camel/component/alibaba/fc/alibaba-fc.json | 4 + .../camel/component/alibaba/fc/FCEndpoint.java | 18 +++++ .../camel/component/alibaba/kms/alibaba-kms.json | 4 + .../camel/component/alibaba/kms/KMSEndpoint.java | 20 +++++ .../camel/component/alibaba/mns/alibaba-mns.json | 5 ++ .../camel/component/alibaba/mns/MNSEndpoint.java | 17 +++++ .../camel/component/alibaba/oss/alibaba-oss.json | 5 ++ .../src/main/docs/alibaba-oss-component.adoc | 2 +- .../camel/component/alibaba/oss/OSSEndpoint.java | 27 +++++++ .../camel/component/alibaba/ots/alibaba-ots.json | 4 + .../component/alibaba/ots/AlibabaOtsEndpoint.java | 23 ++++++ .../camel/component/alibaba/sls/alibaba-sls.json | 4 + .../src/main/docs/alibaba-sls-component.adoc | 2 +- .../component/alibaba/sls/AlibabaSlsEndpoint.java | 12 +++ .../camel/component/alibaba/sms/alibaba-sms.json | 4 + .../camel/component/alibaba/sms/SMSEndpoint.java | 10 +++ .../org/apache/camel/component/consul/consul.json | 5 ++ .../src/main/docs/consul-component.adoc | 5 +- .../camel/component/consul/ConsulEndpoint.java | 89 ++++++++++++++++++++++ .../org/apache/camel/component/dapr/dapr.json | 5 ++ .../apache/camel/component/dapr/DaprEndpoint.java | 46 +++++++++++ 38 files changed, 389 insertions(+), 10 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-eventbridge.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-eventbridge.json index f75f8736f728..4941f451915c 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-eventbridge.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-eventbridge.json @@ -41,6 +41,10 @@ "CamelAlibabaEventBridgeEventSourceCacheTtl": { "index": 8, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "TTL in milliseconds for cached bus event sources and types", "constantName": "org.apache.camel.component.alibaba.eventbridge.constants.AlibabaEventBridgeHeaders#EVENT_SOURCE_CACHE_TTL" }, "CamelAlibabaEventBridgeRequestId": { "index": 9, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Alibaba Cloud request id", "constantName": "org.apache.camel.component.alibaba.eventbridge.constants.AlibabaEventBridgeHeaders#REQUEST_ID" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "text", "map", "list", "pojo" ], "description": "The event to publish: the JSON text of the data of the event, with the source, the type and the bus from the options or headers; a Map of the event fields, such as eventSource, eventType and eventData, where a Map or a POJO as data is serialized to JSON; a CloudEvent of the Alibaba SDK; or a List of these for a batch. Bytes, a stream, a file, another POJO or no body fail: convert to text first" }, + "producerOut": { "carriers": [ "map" ], "javaType": "java.util.Map", "description": "A Map with the requestId, the failedEntryCount, the resourceOwnerAccountId and the entryList of the response, with the request id in the CamelAlibabaEventBridgeRequestId header too. An event that EventBridge rejects does not fail the exchange: check failedEntryCount" } + }, "properties": { "operation": { "index": 0, "kind": "path", "displayName": "Operation", "group": "producer", "label": "producer", "required": true, "type": "enum", "javaType": "java.lang.String", "enum": [ "putEvents" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Operation to perform" }, "allowedEventSources": { "index": 1, "kind": "parameter", "displayName": "Allowed Event Sources", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Allowed event sources and source-scoped event types per event bus. Supports multi-bus DSL (bussrc - type1,type2), single-bus shorthand (src - type1,type2), JSON string, or Map\/List objects." }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-fc.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-fc.json index 9ea729fe3615..e8c6c54ddeb5 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-fc.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-fc.json @@ -36,6 +36,10 @@ "CamelAlibabaFcRequestId": { "index": 3, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Alibaba Cloud request id", "constantName": "org.apache.camel.component.alibaba.fc.constants.FCHeaders#REQUEST_ID" }, "CamelAlibabaFcStatusCode": { "index": 4, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "HTTP status code from FC invoke response", "constantName": "org.apache.camel.component.alibaba.fc.constants.FCHeaders#STATUS_CODE" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "operation", "value": "invokeFunction", "carriers": [ "text", "bytes", "stream", "file", "null" ] } ], "description": "invokeFunction sends the body as the payload of the function: text and bytes as they are, a stream or a file read as text, which corrupts binary data, a Map or a POJO as its toString(), so marshal it first, and no body as an empty payload. getFunction does not use the body" }, + "producerOut": { "carriers": [ "map" ], "javaType": "java.util.Map", "description": "A Map: for invokeFunction the statusCode, the headers and the body of the response, which holds the payload the function returns as bytes, with the status code in the CamelAlibabaFcStatusCode header too; for getFunction the fields of the function, such as functionName, runtime and handler" } + }, "properties": { "operation": { "index": 0, "kind": "path", "displayName": "Operation", "group": "producer", "label": "producer", "required": true, "type": "enum", "javaType": "java.lang.String", "enum": [ "invokeFunction", "getFunction" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Operation to perform" }, "endpoint": { "index": 1, "kind": "parameter", "displayName": "Endpoint", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "FC endpoint URL. Carries higher precedence than region based client initialization" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-kms.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-kms.json index cac3882b1de1..38569bdbe77f 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-kms.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-kms.json @@ -37,6 +37,10 @@ "CamelAlibabaKmsNumberOfBytes": { "index": 4, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Number of bytes for generateDataKey", "constantName": "org.apache.camel.component.alibaba.kms.constants.KMSHeaders#NUMBER_OF_BYTES" }, "CamelAlibabaKmsRequestId": { "index": 5, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Alibaba Cloud request id", "constantName": "org.apache.camel.component.alibaba.kms.constants.KMSHeaders#REQUEST_ID" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "operation", "value": "encrypt", "carriers": [ "text", "bytes", "stream", "file" ] }, { "option": "operation", "value": "decrypt", "carriers": [ "text" ] } ], "description": "encrypt encrypts the body unless the plaintext option or header is set: text and bytes as they are, a stream or a file read as text, which corrupts binary data, and a Map or a POJO as its toString(), so marshal it first. decrypt takes the ciphertex [...] + "producerOut": { "carriers": [ "map" ], "javaType": "java.util.Map", "description": "A Map with the statusCode and the fields of the response: the ciphertextBlob and keyId of encrypt, the plaintext of decrypt, which is Base64 when this component encrypted it, and the plaintext and ciphertextBlob of generateDataKey. The request id is in the CamelAlibabaKmsRequestId header too" } + }, "properties": { "operation": { "index": 0, "kind": "path", "displayName": "Operation", "group": "producer", "label": "producer", "required": true, "type": "enum", "javaType": "java.lang.String", "enum": [ "encrypt", "decrypt", "generateDataKey" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Operation to perform" }, "endpoint": { "index": 1, "kind": "parameter", "displayName": "Endpoint", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "KMS endpoint URL. Carries higher precedence than region based client initialization" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-mns.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-mns.json index be6c68ec2096..2d30317d1309 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-mns.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-mns.json @@ -42,6 +42,11 @@ "CamelAlibabaMnsNextVisibleTime": { "index": 8, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "java.util.Date", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Next time the message becomes visible", "constantName": "org.apache.camel.component.alibaba.mns.constants.MNSHeaders#NEXT_VISIBLE_TIME" }, "CamelAlibabaMnsFirstDequeueTime": { "index": 9, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "java.util.Date", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Time when the message was first dequeued", "constantName": "org.apache.camel.component.alibaba.mns.constants.MNSHeaders#FIRST_DEQUEUE_TIME" } }, + "bodyTypes": { + "consumerOut": { "carriers": [ "text" ], "javaType": "java.lang.String", "description": "The body of the MNS message as text, with the message id, the receipt handle and the dequeue count in headers" }, + "producerIn": { "carriers": [ "text", "bytes", "stream", "file" ], "byOption": [ { "option": "operation", "value": "deleteMessage", "carriers": [ "any" ] } ], "description": "The body of the message to send or publish, as text: bytes, a stream or a file are read as text, which corrupts binary data, a Map or a POJO is sent as its toString(), so marshal it first, and no body fails. deleteMessage does not use the body: it takes the receipt handle from the CamelAlibabaMnsReceiptHandle he [...] + "producerOut": { "carriers": [ "unchanged" ], "description": "Unchanged: the message id, the request id and the MD5 of the body are set as exchange properties, not headers" } + }, "properties": { "queueName": { "index": 0, "kind": "path", "displayName": "Queue Name", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Queue name, or topic name when using the topic URI syntax" }, "accountEndpoint": { "index": 1, "kind": "parameter", "displayName": "Account Endpoint", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "MNS account endpoint, for example https:\/\/123456.mns.cn-hangzhou.aliyuncs.com" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-oss.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-oss.json index 16cf5da238dc..ec9111d67445 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-oss.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-oss.json @@ -41,6 +41,11 @@ "CamelAlibabaOssContentType": { "index": 7, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The type of content stored in the object", "constantName": "org.apache.camel.component.alibaba.oss.constants.OSSHeaders#CONTENT_TYPE" }, "CamelFileName": { "index": 8, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Name of the object with which the operation is to be performed", "constantName": "org.apache.camel.component.alibaba.oss.constants.OSSHeaders#FILE_NAME" } }, + "bodyTypes": { + "consumerOut": { "carriers": [ "bytes" ], "javaType": "byte[]", "description": "The content of the object as a byte array, one message per object, with its bucket, key and metadata in headers" }, + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "operation", "value": "putObject", "carriers": [ "text", "bytes", "stream", "file" ] } ], "description": "The content to upload for putObject: text, bytes, a stream or a file (a file without objectName is stored under its file name). A Map, a List or a POJO fails: marshal it first. The other operations do not read the body, they take their input from options and headers" }, + "producerOut": { "carriers": [ "map" ], "byOption": [ { "option": "operation", "value": "getObject", "carriers": [ "bytes" ], "javaType": "byte[]" }, { "option": "operation", "value": "listObjects", "carriers": [ "list" ], "javaType": "java.util.List<java.util.Map<String, Object>>" }, { "option": "operation", "value": "listBuckets", "carriers": [ "list" ], "javaType": "java.util.List<java.util.Map<String, Object>>" } ], "description": "A Map of the result for putObject, deleteObject, [...] + }, "properties": { "bucketName": { "index": 0, "kind": "path", "displayName": "Bucket Name", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of bucket to perform operation on" }, "endpoint": { "index": 1, "kind": "parameter", "displayName": "Endpoint url", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "OSS endpoint URL. Carries higher precedence than region based client initialization" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-ots.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-ots.json index 22e55f89d557..822fc4dcf5b7 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-ots.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-ots.json @@ -33,6 +33,10 @@ "CamelAlibabaOtsOperation": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Operation override", "constantName": "org.apache.camel.component.alibaba.ots.constants.AlibabaOtsHeaders#OPERATION" }, "CamelAlibabaOtsRequestId": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Tablestore request id", "constantName": "org.apache.camel.component.alibaba.ots.constants.AlibabaOtsHeaders#REQUEST_ID" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "operation", "value": "putRow", "carriers": [ "pojo" ], "javaType": "com.alicloud.openservices.tablestore.model.PutRowRequest" }, { "option": "operation", "value": "getRow", "carriers": [ "pojo" ], "javaType": "com.alicloud.openservices.tablestore.model.GetRowRequest" }, { "option": "operation", "value": "updateRow", "carriers": [ "pojo" ], "javaType": "com.alicloud.openservices.tablestore.model.UpdateRowRequest" }, { " [...] + "producerOut": { "carriers": [ "map" ], "byOption": [ { "option": "operation", "value": "listTables", "carriers": [ "list" ], "javaType": "java.util.List<String>" } ], "description": "A Map of the response for the row operations: the requestId, the consumedCapacity and the row as a Map of its primaryKey and columns. listTables gives a List of the table names" } + }, "properties": { "operation": { "index": 0, "kind": "path", "displayName": "Operation", "group": "producer", "label": "producer", "required": true, "type": "enum", "javaType": "java.lang.String", "enum": [ "putRow", "getRow", "updateRow", "deleteRow", "listTables" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Operation to perform" }, "endpoint": { "index": 1, "kind": "parameter", "displayName": "Endpoint", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Tablestore endpoint URL" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-sls.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-sls.json index e8de5894f643..1a457cc7a542 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-sls.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-sls.json @@ -48,6 +48,10 @@ "CamelAlibabaSlsRequestId": { "index": 15, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Alibaba Cloud request id", "constantName": "org.apache.camel.component.alibaba.sls.constants.AlibabaSlsHeaders#REQUEST_ID" }, "CamelAlibabaSlsStatusCode": { "index": 16, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "HTTP status code from SLS response", "constantName": "org.apache.camel.component.alibaba.sls.constants.AlibabaSlsHeaders#STATUS_CODE" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "operation", "value": "putLogs", "carriers": [ "pojo" ] } ], "description": "The logs to write for putLogs: a LogGroup or a PutLogsRequest of the SLS SDK, any other body fails. getLogs and listLogStores do not read the body, they take their input from options and headers" }, + "producerOut": { "carriers": [ "map" ], "description": "A Map of the response with its statusCode and headers. For getLogs the GetLogsResponseBody of the SLS SDK is under body, for listLogStores the names under logstores with count and total" } + }, "properties": { "operation": { "index": 0, "kind": "path", "displayName": "Operation", "group": "producer", "label": "producer", "required": true, "type": "enum", "javaType": "java.lang.String", "enum": [ "putLogs", "getLogs", "listLogStores" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Operation to perform" }, "endpoint": { "index": 1, "kind": "parameter", "displayName": "Endpoint", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "SLS endpoint URL (e.g. cn-hangzhou.log.aliyuncs.com). Carries higher precedence than region based client initialization" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-sms.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-sms.json index 8c4420bf7e85..45992f320ac7 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-sms.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-sms.json @@ -37,6 +37,10 @@ "CamelAlibabaSmsOutId": { "index": 4, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Out id for the SMS", "constantName": "org.apache.camel.component.alibaba.sms.constants.SMSHeaders#OUT_ID" }, "CamelAlibabaSmsRequestId": { "index": 5, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Alibaba Cloud request id", "constantName": "org.apache.camel.component.alibaba.sms.constants.SMSHeaders#REQUEST_ID" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "description": "Not used: sendSms takes the phone numbers, sign name, template code and template parameters from options or headers, such as CamelAlibabaSmsTemplateParam" }, + "producerOut": { "carriers": [ "map" ], "description": "A Map of the response: the statusCode, and the code, message, bizId and requestId the service returns" } + }, "properties": { "operation": { "index": 0, "kind": "path", "displayName": "Operation", "group": "producer", "label": "producer", "required": true, "type": "enum", "javaType": "java.lang.String", "enum": [ "sendSms" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Operation to perform" }, "endpoint": { "index": 1, "kind": "parameter", "displayName": "Endpoint", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "SMS endpoint URL. Carries higher precedence than region based client initialization" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/consul.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/consul.json index 9c757e17dfd9..5e1b82d6b738 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/consul.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/consul.json @@ -84,6 +84,11 @@ "CamelConsulPreparedQueryID": { "index": 29, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The id of the prepared query", "constantName": "org.apache.camel.component.consul.ConsulConstants#CONSUL_PREPARED_QUERY_ID" }, "CamelConsulServiceId": { "index": 30, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The service id for agent deregistration", "constantName": "org.apache.camel.component.consul.ConsulConstants#CONSUL_SERVICE_ID" } }, + "bodyTypes": { + "consumerOut": { "carriers": [ "text", "null" ], "description": "The kv consumer: the value of the key (of each key under it with recursive) base64 encoded as Consul stores it, decoded with valueAsString=true, with the key, flags and indexes in headers; null for a key without value. The event consumer: the payload of the event as text, with its name and id in headers" }, + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "action", "value": "PUT", "carriers": [ "text", "bytes", "stream", "file", "value", "null" ] }, { "option": "action", "value": "LOCK", "carriers": [ "text", "bytes", "stream", "file", "value", "null" ] }, { "option": "action", "value": "FIRE", "carriers": [ "text", "bytes", "stream", "file", "value" ] }, { "option": "action", "value": "REGISTER", "carriers": [ "pojo" ] }, { "option": "action", "value": "CREATE", "carrie [...] + "producerOut": { "carriers": [ "pojo", "list", "map", "text", "unchanged" ], "byOption": [ { "option": "action", "value": "CHECKS", "carriers": [ "map", "list" ] }, { "option": "action", "value": "SERVICES", "carriers": [ "map" ] }, { "option": "action", "value": "MEMBERS", "carriers": [ "list" ] }, { "option": "action", "value": "AGENT", "carriers": [ "pojo" ], "javaType": "org.kiwiproject.consul.model.agent.Agent" }, { "option": "action", "value": "REGISTER", "carriers": [ "unchang [...] + }, "properties": { "apiEndpoint": { "index": 0, "kind": "path", "displayName": "Api Endpoint", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The API endpoint" }, "connectTimeout": { "index": 1, "kind": "parameter", "displayName": "Connect Timeout", "group": "common", "label": "", "required": false, "type": "duration", "javaType": "java.time.Duration", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.consul.ConsulConfiguration", "configurationField": "configuration", "description": "Connect timeout" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/dapr.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/dapr.json index d590402e4d10..a5886881c019 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/dapr.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/dapr.json @@ -125,6 +125,11 @@ "CamelDaprTimeout": { "index": 56, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Duration", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The amount of time to wait for the workflow instance to start\/complete", "constantName": "org.apache.camel.component.dapr.DaprConstants#TIMEOUT" }, "CamelDaprEventName": { "index": 57, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The name of the event. Event names are case-insensitive", "constantName": "org.apache.camel.component.dapr.DaprConstants#EVENT_NAME" } }, + "bodyTypes": { + "consumerOut": { "carriers": [ "bytes", "map" ], "byOption": [ { "option": "operation", "value": "pubSub", "carriers": [ "bytes" ], "javaType": "byte[]" }, { "option": "operation", "value": "configuration", "carriers": [ "map" ], "javaType": "java.util.Map<java.lang.String, java.lang.String>" } ], "description": "For pubSub the data of the cloud event as bytes, with its id, type, source and content type in headers. For configuration a Map of the changed keys and their values, with th [...] + "producerIn": { "carriers": [ "text", "bytes", "value", "map", "list", "pojo", "null" ], "description": "The data of invokeService, pubSub, invokeBinding, state save and the workflow input, event and output, given to the Dapr client as is: bytes are sent as they are, other bodies are serialized as JSON (text as a JSON string), and a stream fails: convert it to bytes first. State save needs a body; the other operations do not read it" }, + "producerOut": { "carriers": [ "bytes", "pojo", "list", "map", "value", "unchanged", "null" ], "byOption": [ { "option": "operation", "value": "invokeService", "carriers": [ "bytes", "null" ] }, { "option": "operation", "value": "invokeBinding", "carriers": [ "bytes", "null" ] }, { "option": "operation", "value": "pubSub", "carriers": [ "pojo" ], "javaType": "io.dapr.client.domain.PublishEventRequest" }, { "option": "operation", "value": "state", "carriers": [ "pojo", "list" ] }, { " [...] + }, "properties": { "operation": { "index": 0, "kind": "path", "displayName": "Operation", "group": "producer", "label": "producer", "required": true, "type": "enum", "javaType": "org.apache.camel.component.dapr.DaprOperation", "enum": [ "invokeService", "state", "pubSub", "invokeBinding", "secret", "configuration", "lock", "workflow" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.dapr.DaprConfiguration", "configurati [...] "client": { "index": 1, "kind": "parameter", "displayName": "Client", "group": "common", "label": "common", "required": false, "type": "object", "javaType": "io.dapr.client.DaprClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.dapr.DaprConfiguration", "configurationField": "configuration", "description": "The Dapr Client" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/alibaba-eventbridge-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/alibaba-eventbridge-component.adoc index c10a7a1dc067..471d30d001f7 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/alibaba-eventbridge-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/alibaba-eventbridge-component.adoc @@ -165,7 +165,9 @@ Java:: ---- from("platform-http:/ingress") .removeHeaders("CamelAlibabaEventBridge*") - .to("alibaba-eventbridge:putEvents?eventBusName=orders-bus&allowedEventSources=RAW(app.orders -> order:created:v1)®ion=cn-hangzhou"); + .convertBodyTo(String.class) + .to("alibaba-eventbridge:putEvents?eventBusName=orders-bus&allowedEventSources=RAW(app.orders -> order:created:v1)®ion=cn-hangzhou") + .marshal().json(); ---- YAML:: @@ -178,12 +180,16 @@ YAML:: steps: - removeHeaders: pattern: CamelAlibabaEventBridge* + - convertBodyTo: + type: String - to: uri: alibaba-eventbridge:putEvents parameters: eventBusName: orders-bus allowedEventSources: "RAW(app.orders -> order:created:v1)" region: cn-hangzhou + - marshal: + json: {} ---- ==== ====== diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/alibaba-oss-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/alibaba-oss-component.adoc index 7178728b30b6..b48d105556da 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/alibaba-oss-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/alibaba-oss-component.adoc @@ -123,7 +123,7 @@ In YAML, the object name is the `objectName` option, which the producer uses whe ---- ==== -Producer operations return structured response metadata in the message body (`Map` or `List<Map>` depending on the operation). +The `getObject` operation returns the content of the object as a `byte[]` in the message body, with its metadata in headers. `listObjects` and `listBuckets` return a `List<Map>`, and the other operations return the response metadata as a `Map`. === Consume objects from a bucket diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/alibaba-sls-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/alibaba-sls-component.adoc index cd37f8245ac0..cd11cd6fa40b 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/alibaba-sls-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/alibaba-sls-component.adoc @@ -54,7 +54,7 @@ The component supports the following operations: === Producer examples -Put logs: +Put logs, where the message body must be a `LogGroup` or a `PutLogsRequest` of the SLS SDK (any other body fails): [tabs] ==== diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/consul-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/consul-component.adoc index 15151ff16cdf..1b8a97222470 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/consul-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/consul-component.adoc @@ -101,8 +101,8 @@ consul:agent?action=REGISTER The `kv` endpoint reads and writes the key-value store of Consul. The action comes from the `action` option or the `CamelConsulAction` header (the header wins), and the key from the `key` option or the `CamelConsulKey` header. -A PUT stores the message body as the value. A GET_VALUE sets the value as the message body, and `valueAsString` -makes it a string: +A PUT stores the message body, converted to a string, as the value. A GET_VALUE sets the `Value` of the Consul client +as the message body, which holds the value base64 encoded, and `valueAsString` makes the body the value as a string: [source,yaml] ---- @@ -139,6 +139,7 @@ makes it a string: A consumer of the `kv` endpoint watches a key with a blocking query of `blockSeconds` (10 by default). The route gets the value each time the query returns: when the value changes, or when the wait ends. +The body is the value base64 encoded, as Consul stores it, unless `valueAsString` is set. [source,yaml] ---- diff --git a/components/camel-alibaba/camel-alibaba-eventbridge/src/generated/resources/META-INF/org/apache/camel/component/alibaba/eventbridge/alibaba-eventbridge.json b/components/camel-alibaba/camel-alibaba-eventbridge/src/generated/resources/META-INF/org/apache/camel/component/alibaba/eventbridge/alibaba-eventbridge.json index f75f8736f728..4941f451915c 100644 --- a/components/camel-alibaba/camel-alibaba-eventbridge/src/generated/resources/META-INF/org/apache/camel/component/alibaba/eventbridge/alibaba-eventbridge.json +++ b/components/camel-alibaba/camel-alibaba-eventbridge/src/generated/resources/META-INF/org/apache/camel/component/alibaba/eventbridge/alibaba-eventbridge.json @@ -41,6 +41,10 @@ "CamelAlibabaEventBridgeEventSourceCacheTtl": { "index": 8, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "TTL in milliseconds for cached bus event sources and types", "constantName": "org.apache.camel.component.alibaba.eventbridge.constants.AlibabaEventBridgeHeaders#EVENT_SOURCE_CACHE_TTL" }, "CamelAlibabaEventBridgeRequestId": { "index": 9, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Alibaba Cloud request id", "constantName": "org.apache.camel.component.alibaba.eventbridge.constants.AlibabaEventBridgeHeaders#REQUEST_ID" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "text", "map", "list", "pojo" ], "description": "The event to publish: the JSON text of the data of the event, with the source, the type and the bus from the options or headers; a Map of the event fields, such as eventSource, eventType and eventData, where a Map or a POJO as data is serialized to JSON; a CloudEvent of the Alibaba SDK; or a List of these for a batch. Bytes, a stream, a file, another POJO or no body fail: convert to text first" }, + "producerOut": { "carriers": [ "map" ], "javaType": "java.util.Map", "description": "A Map with the requestId, the failedEntryCount, the resourceOwnerAccountId and the entryList of the response, with the request id in the CamelAlibabaEventBridgeRequestId header too. An event that EventBridge rejects does not fail the exchange: check failedEntryCount" } + }, "properties": { "operation": { "index": 0, "kind": "path", "displayName": "Operation", "group": "producer", "label": "producer", "required": true, "type": "enum", "javaType": "java.lang.String", "enum": [ "putEvents" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Operation to perform" }, "allowedEventSources": { "index": 1, "kind": "parameter", "displayName": "Allowed Event Sources", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Allowed event sources and source-scoped event types per event bus. Supports multi-bus DSL (bussrc - type1,type2), single-bus shorthand (src - type1,type2), JSON string, or Map\/List objects." }, diff --git a/components/camel-alibaba/camel-alibaba-eventbridge/src/main/docs/alibaba-eventbridge-component.adoc b/components/camel-alibaba/camel-alibaba-eventbridge/src/main/docs/alibaba-eventbridge-component.adoc index c10a7a1dc067..471d30d001f7 100644 --- a/components/camel-alibaba/camel-alibaba-eventbridge/src/main/docs/alibaba-eventbridge-component.adoc +++ b/components/camel-alibaba/camel-alibaba-eventbridge/src/main/docs/alibaba-eventbridge-component.adoc @@ -165,7 +165,9 @@ Java:: ---- from("platform-http:/ingress") .removeHeaders("CamelAlibabaEventBridge*") - .to("alibaba-eventbridge:putEvents?eventBusName=orders-bus&allowedEventSources=RAW(app.orders -> order:created:v1)®ion=cn-hangzhou"); + .convertBodyTo(String.class) + .to("alibaba-eventbridge:putEvents?eventBusName=orders-bus&allowedEventSources=RAW(app.orders -> order:created:v1)®ion=cn-hangzhou") + .marshal().json(); ---- YAML:: @@ -178,12 +180,16 @@ YAML:: steps: - removeHeaders: pattern: CamelAlibabaEventBridge* + - convertBodyTo: + type: String - to: uri: alibaba-eventbridge:putEvents parameters: eventBusName: orders-bus allowedEventSources: "RAW(app.orders -> order:created:v1)" region: cn-hangzhou + - marshal: + json: {} ---- ==== ====== diff --git a/components/camel-alibaba/camel-alibaba-eventbridge/src/main/java/org/apache/camel/component/alibaba/eventbridge/AlibabaEventBridgeEndpoint.java b/components/camel-alibaba/camel-alibaba-eventbridge/src/main/java/org/apache/camel/component/alibaba/eventbridge/AlibabaEventBridgeEndpoint.java index 4958702619d2..9bb294e96757 100644 --- a/components/camel-alibaba/camel-alibaba-eventbridge/src/main/java/org/apache/camel/component/alibaba/eventbridge/AlibabaEventBridgeEndpoint.java +++ b/components/camel-alibaba/camel-alibaba-eventbridge/src/main/java/org/apache/camel/component/alibaba/eventbridge/AlibabaEventBridgeEndpoint.java @@ -23,6 +23,9 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.alibaba.common.models.ServiceKeys; import org.apache.camel.component.alibaba.eventbridge.constants.AlibabaEventBridgeHeaders; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -35,6 +38,18 @@ import org.apache.camel.support.DefaultEndpoint; @UriEndpoint(firstVersion = "4.23.0", scheme = "alibaba-eventbridge", title = "Alibaba EventBridge", syntax = "alibaba-eventbridge:operation", category = { Category.CLOUD, Category.MESSAGING }, headersClass = AlibabaEventBridgeHeaders.class, producerOnly = true) +@BodyTypes(producerIn = @BodyType(value = { Carrier.TEXT, Carrier.MAP, Carrier.LIST, Carrier.POJO }, + description = "The event to publish: the JSON text of the data of the event, with the source," + + " the type and the bus from the options or headers; a Map of the event" + + " fields, such as eventSource, eventType and eventData, where a Map or a POJO" + + " as data is serialized to JSON; a CloudEvent of the Alibaba SDK; or a List of" + + " these for a batch. Bytes, a stream, a file, another POJO or no body fail:" + + " convert to text first"), + producerOut = @BodyType(value = Carrier.MAP, javaType = "java.util.Map", + description = "A Map with the requestId, the failedEntryCount, the resourceOwnerAccountId" + + " and the entryList of the response, with the request id in the" + + " CamelAlibabaEventBridgeRequestId header too. An event that EventBridge" + + " rejects does not fail the exchange: check failedEntryCount")) public class AlibabaEventBridgeEndpoint extends DefaultEndpoint { @UriPath(description = "Operation to perform", displayName = "Operation", label = "producer", diff --git a/components/camel-alibaba/camel-alibaba-fc/src/generated/resources/META-INF/org/apache/camel/component/alibaba/fc/alibaba-fc.json b/components/camel-alibaba/camel-alibaba-fc/src/generated/resources/META-INF/org/apache/camel/component/alibaba/fc/alibaba-fc.json index 9ea729fe3615..e8c6c54ddeb5 100644 --- a/components/camel-alibaba/camel-alibaba-fc/src/generated/resources/META-INF/org/apache/camel/component/alibaba/fc/alibaba-fc.json +++ b/components/camel-alibaba/camel-alibaba-fc/src/generated/resources/META-INF/org/apache/camel/component/alibaba/fc/alibaba-fc.json @@ -36,6 +36,10 @@ "CamelAlibabaFcRequestId": { "index": 3, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Alibaba Cloud request id", "constantName": "org.apache.camel.component.alibaba.fc.constants.FCHeaders#REQUEST_ID" }, "CamelAlibabaFcStatusCode": { "index": 4, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "HTTP status code from FC invoke response", "constantName": "org.apache.camel.component.alibaba.fc.constants.FCHeaders#STATUS_CODE" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "operation", "value": "invokeFunction", "carriers": [ "text", "bytes", "stream", "file", "null" ] } ], "description": "invokeFunction sends the body as the payload of the function: text and bytes as they are, a stream or a file read as text, which corrupts binary data, a Map or a POJO as its toString(), so marshal it first, and no body as an empty payload. getFunction does not use the body" }, + "producerOut": { "carriers": [ "map" ], "javaType": "java.util.Map", "description": "A Map: for invokeFunction the statusCode, the headers and the body of the response, which holds the payload the function returns as bytes, with the status code in the CamelAlibabaFcStatusCode header too; for getFunction the fields of the function, such as functionName, runtime and handler" } + }, "properties": { "operation": { "index": 0, "kind": "path", "displayName": "Operation", "group": "producer", "label": "producer", "required": true, "type": "enum", "javaType": "java.lang.String", "enum": [ "invokeFunction", "getFunction" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Operation to perform" }, "endpoint": { "index": 1, "kind": "parameter", "displayName": "Endpoint", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "FC endpoint URL. Carries higher precedence than region based client initialization" }, diff --git a/components/camel-alibaba/camel-alibaba-fc/src/main/java/org/apache/camel/component/alibaba/fc/FCEndpoint.java b/components/camel-alibaba/camel-alibaba-fc/src/main/java/org/apache/camel/component/alibaba/fc/FCEndpoint.java index 156628085a81..f2021bc3cda0 100644 --- a/components/camel-alibaba/camel-alibaba-fc/src/main/java/org/apache/camel/component/alibaba/fc/FCEndpoint.java +++ b/components/camel-alibaba/camel-alibaba-fc/src/main/java/org/apache/camel/component/alibaba/fc/FCEndpoint.java @@ -23,6 +23,9 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.alibaba.common.models.ServiceKeys; import org.apache.camel.component.alibaba.fc.constants.FCHeaders; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -35,6 +38,21 @@ import org.apache.camel.support.DefaultEndpoint; @UriEndpoint(firstVersion = "4.23.0", scheme = "alibaba-fc", title = "Alibaba Function Compute (FC)", syntax = "alibaba-fc:operation", category = { Category.CLOUD, Category.SERVERLESS }, headersClass = FCHeaders.class, producerOnly = true) +@BodyTypes(producerIn = @BodyType(value = Carrier.ANY, + byOption = @BodyType.When(option = "operation", value = "invokeFunction", + carriers = { + Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, Carrier.FILE, + Carrier.NULL }), + description = "invokeFunction sends the body as the payload of the function: text and bytes" + + " as they are, a stream or a file read as text, which corrupts binary data, a" + + " Map or a POJO as its toString(), so marshal it first, and no body as an" + + " empty payload. getFunction does not use the body"), + producerOut = @BodyType(value = Carrier.MAP, javaType = "java.util.Map", + description = "A Map: for invokeFunction the statusCode, the headers and the body of the" + + " response, which holds the payload the function returns as bytes, with" + + " the status code in the CamelAlibabaFcStatusCode header too; for" + + " getFunction the fields of the function, such as functionName, runtime" + + " and handler")) public class FCEndpoint extends DefaultEndpoint { @UriPath(description = "Operation to perform", displayName = "Operation", label = "producer", diff --git a/components/camel-alibaba/camel-alibaba-kms/src/generated/resources/META-INF/org/apache/camel/component/alibaba/kms/alibaba-kms.json b/components/camel-alibaba/camel-alibaba-kms/src/generated/resources/META-INF/org/apache/camel/component/alibaba/kms/alibaba-kms.json index cac3882b1de1..38569bdbe77f 100644 --- a/components/camel-alibaba/camel-alibaba-kms/src/generated/resources/META-INF/org/apache/camel/component/alibaba/kms/alibaba-kms.json +++ b/components/camel-alibaba/camel-alibaba-kms/src/generated/resources/META-INF/org/apache/camel/component/alibaba/kms/alibaba-kms.json @@ -37,6 +37,10 @@ "CamelAlibabaKmsNumberOfBytes": { "index": 4, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Number of bytes for generateDataKey", "constantName": "org.apache.camel.component.alibaba.kms.constants.KMSHeaders#NUMBER_OF_BYTES" }, "CamelAlibabaKmsRequestId": { "index": 5, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Alibaba Cloud request id", "constantName": "org.apache.camel.component.alibaba.kms.constants.KMSHeaders#REQUEST_ID" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "operation", "value": "encrypt", "carriers": [ "text", "bytes", "stream", "file" ] }, { "option": "operation", "value": "decrypt", "carriers": [ "text" ] } ], "description": "encrypt encrypts the body unless the plaintext option or header is set: text and bytes as they are, a stream or a file read as text, which corrupts binary data, and a Map or a POJO as its toString(), so marshal it first. decrypt takes the ciphertex [...] + "producerOut": { "carriers": [ "map" ], "javaType": "java.util.Map", "description": "A Map with the statusCode and the fields of the response: the ciphertextBlob and keyId of encrypt, the plaintext of decrypt, which is Base64 when this component encrypted it, and the plaintext and ciphertextBlob of generateDataKey. The request id is in the CamelAlibabaKmsRequestId header too" } + }, "properties": { "operation": { "index": 0, "kind": "path", "displayName": "Operation", "group": "producer", "label": "producer", "required": true, "type": "enum", "javaType": "java.lang.String", "enum": [ "encrypt", "decrypt", "generateDataKey" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Operation to perform" }, "endpoint": { "index": 1, "kind": "parameter", "displayName": "Endpoint", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "KMS endpoint URL. Carries higher precedence than region based client initialization" }, diff --git a/components/camel-alibaba/camel-alibaba-kms/src/main/java/org/apache/camel/component/alibaba/kms/KMSEndpoint.java b/components/camel-alibaba/camel-alibaba-kms/src/main/java/org/apache/camel/component/alibaba/kms/KMSEndpoint.java index 26b38ad1ab84..438147a56da1 100644 --- a/components/camel-alibaba/camel-alibaba-kms/src/main/java/org/apache/camel/component/alibaba/kms/KMSEndpoint.java +++ b/components/camel-alibaba/camel-alibaba-kms/src/main/java/org/apache/camel/component/alibaba/kms/KMSEndpoint.java @@ -23,6 +23,9 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.alibaba.common.models.ServiceKeys; import org.apache.camel.component.alibaba.kms.constants.KMSHeaders; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -35,6 +38,23 @@ import org.apache.camel.support.DefaultEndpoint; @UriEndpoint(firstVersion = "4.23.0", scheme = "alibaba-kms", title = "Alibaba Key Management Service (KMS)", syntax = "alibaba-kms:operation", category = { Category.CLOUD }, headersClass = KMSHeaders.class, producerOnly = true) +@BodyTypes(producerIn = @BodyType(value = Carrier.ANY, + byOption = { + @BodyType.When(option = "operation", value = "encrypt", + carriers = { + Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, Carrier.FILE }), + @BodyType.When(option = "operation", value = "decrypt", carriers = Carrier.TEXT) }, + description = "encrypt encrypts the body unless the plaintext option or header is set: text" + + " and bytes as they are, a stream or a file read as text, which corrupts" + + " binary data, and a Map or a POJO as its toString(), so marshal it first." + + " decrypt takes the ciphertext blob as text, unless the ciphertextBlob option" + + " or header is set. No body fails both; generateDataKey does not use the body"), + producerOut = @BodyType(value = Carrier.MAP, javaType = "java.util.Map", + description = "A Map with the statusCode and the fields of the response: the ciphertextBlob" + + " and keyId of encrypt, the plaintext of decrypt, which is Base64 when this" + + " component encrypted it, and the plaintext and ciphertextBlob of" + + " generateDataKey. The request id is in the CamelAlibabaKmsRequestId header" + + " too")) public class KMSEndpoint extends DefaultEndpoint { @UriPath(description = "Operation to perform", displayName = "Operation", label = "producer", diff --git a/components/camel-alibaba/camel-alibaba-mns/src/generated/resources/META-INF/org/apache/camel/component/alibaba/mns/alibaba-mns.json b/components/camel-alibaba/camel-alibaba-mns/src/generated/resources/META-INF/org/apache/camel/component/alibaba/mns/alibaba-mns.json index be6c68ec2096..2d30317d1309 100644 --- a/components/camel-alibaba/camel-alibaba-mns/src/generated/resources/META-INF/org/apache/camel/component/alibaba/mns/alibaba-mns.json +++ b/components/camel-alibaba/camel-alibaba-mns/src/generated/resources/META-INF/org/apache/camel/component/alibaba/mns/alibaba-mns.json @@ -42,6 +42,11 @@ "CamelAlibabaMnsNextVisibleTime": { "index": 8, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "java.util.Date", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Next time the message becomes visible", "constantName": "org.apache.camel.component.alibaba.mns.constants.MNSHeaders#NEXT_VISIBLE_TIME" }, "CamelAlibabaMnsFirstDequeueTime": { "index": 9, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "java.util.Date", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Time when the message was first dequeued", "constantName": "org.apache.camel.component.alibaba.mns.constants.MNSHeaders#FIRST_DEQUEUE_TIME" } }, + "bodyTypes": { + "consumerOut": { "carriers": [ "text" ], "javaType": "java.lang.String", "description": "The body of the MNS message as text, with the message id, the receipt handle and the dequeue count in headers" }, + "producerIn": { "carriers": [ "text", "bytes", "stream", "file" ], "byOption": [ { "option": "operation", "value": "deleteMessage", "carriers": [ "any" ] } ], "description": "The body of the message to send or publish, as text: bytes, a stream or a file are read as text, which corrupts binary data, a Map or a POJO is sent as its toString(), so marshal it first, and no body fails. deleteMessage does not use the body: it takes the receipt handle from the CamelAlibabaMnsReceiptHandle he [...] + "producerOut": { "carriers": [ "unchanged" ], "description": "Unchanged: the message id, the request id and the MD5 of the body are set as exchange properties, not headers" } + }, "properties": { "queueName": { "index": 0, "kind": "path", "displayName": "Queue Name", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Queue name, or topic name when using the topic URI syntax" }, "accountEndpoint": { "index": 1, "kind": "parameter", "displayName": "Account Endpoint", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "MNS account endpoint, for example https:\/\/123456.mns.cn-hangzhou.aliyuncs.com" }, diff --git a/components/camel-alibaba/camel-alibaba-mns/src/main/java/org/apache/camel/component/alibaba/mns/MNSEndpoint.java b/components/camel-alibaba/camel-alibaba-mns/src/main/java/org/apache/camel/component/alibaba/mns/MNSEndpoint.java index 929ce7bcb663..72a91e9faf91 100644 --- a/components/camel-alibaba/camel-alibaba-mns/src/main/java/org/apache/camel/component/alibaba/mns/MNSEndpoint.java +++ b/components/camel-alibaba/camel-alibaba-mns/src/main/java/org/apache/camel/component/alibaba/mns/MNSEndpoint.java @@ -24,6 +24,9 @@ import org.apache.camel.Producer; import org.apache.camel.component.alibaba.common.models.ServiceKeys; import org.apache.camel.component.alibaba.mns.constants.MNSHeaders; import org.apache.camel.component.alibaba.mns.constants.MNSOperations; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -36,6 +39,20 @@ import org.apache.camel.support.ScheduledPollEndpoint; @UriEndpoint(firstVersion = "4.23.0", scheme = "alibaba-mns", title = "Alibaba Message Service (MNS)", syntax = "alibaba-mns:queueName", category = { Category.CLOUD, Category.MESSAGING }, headersClass = MNSHeaders.class) +@BodyTypes(consumerOut = @BodyType(value = Carrier.TEXT, javaType = "java.lang.String", + description = "The body of the MNS message as text, with the message id, the receipt handle" + + " and the dequeue count in headers"), + producerIn = @BodyType(value = { Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, Carrier.FILE }, + byOption = @BodyType.When(option = "operation", value = "deleteMessage", + carriers = Carrier.ANY), + description = "The body of the message to send or publish, as text: bytes, a stream or a" + + " file are read as text, which corrupts binary data, a Map or a POJO is sent" + + " as its toString(), so marshal it first, and no body fails. deleteMessage" + + " does not use the body: it takes the receipt handle from the" + + " CamelAlibabaMnsReceiptHandle header"), + producerOut = @BodyType(value = Carrier.UNCHANGED, + description = "Unchanged: the message id, the request id and the MD5 of the body are set as" + + " exchange properties, not headers")) public class MNSEndpoint extends ScheduledPollEndpoint { @UriPath(description = "Queue name, or topic name when using the topic URI syntax", displayName = "Queue Name") diff --git a/components/camel-alibaba/camel-alibaba-oss/src/generated/resources/META-INF/org/apache/camel/component/alibaba/oss/alibaba-oss.json b/components/camel-alibaba/camel-alibaba-oss/src/generated/resources/META-INF/org/apache/camel/component/alibaba/oss/alibaba-oss.json index 16cf5da238dc..ec9111d67445 100644 --- a/components/camel-alibaba/camel-alibaba-oss/src/generated/resources/META-INF/org/apache/camel/component/alibaba/oss/alibaba-oss.json +++ b/components/camel-alibaba/camel-alibaba-oss/src/generated/resources/META-INF/org/apache/camel/component/alibaba/oss/alibaba-oss.json @@ -41,6 +41,11 @@ "CamelAlibabaOssContentType": { "index": 7, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The type of content stored in the object", "constantName": "org.apache.camel.component.alibaba.oss.constants.OSSHeaders#CONTENT_TYPE" }, "CamelFileName": { "index": 8, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Name of the object with which the operation is to be performed", "constantName": "org.apache.camel.component.alibaba.oss.constants.OSSHeaders#FILE_NAME" } }, + "bodyTypes": { + "consumerOut": { "carriers": [ "bytes" ], "javaType": "byte[]", "description": "The content of the object as a byte array, one message per object, with its bucket, key and metadata in headers" }, + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "operation", "value": "putObject", "carriers": [ "text", "bytes", "stream", "file" ] } ], "description": "The content to upload for putObject: text, bytes, a stream or a file (a file without objectName is stored under its file name). A Map, a List or a POJO fails: marshal it first. The other operations do not read the body, they take their input from options and headers" }, + "producerOut": { "carriers": [ "map" ], "byOption": [ { "option": "operation", "value": "getObject", "carriers": [ "bytes" ], "javaType": "byte[]" }, { "option": "operation", "value": "listObjects", "carriers": [ "list" ], "javaType": "java.util.List<java.util.Map<String, Object>>" }, { "option": "operation", "value": "listBuckets", "carriers": [ "list" ], "javaType": "java.util.List<java.util.Map<String, Object>>" } ], "description": "A Map of the result for putObject, deleteObject, [...] + }, "properties": { "bucketName": { "index": 0, "kind": "path", "displayName": "Bucket Name", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of bucket to perform operation on" }, "endpoint": { "index": 1, "kind": "parameter", "displayName": "Endpoint url", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "OSS endpoint URL. Carries higher precedence than region based client initialization" }, diff --git a/components/camel-alibaba/camel-alibaba-oss/src/main/docs/alibaba-oss-component.adoc b/components/camel-alibaba/camel-alibaba-oss/src/main/docs/alibaba-oss-component.adoc index 7178728b30b6..b48d105556da 100644 --- a/components/camel-alibaba/camel-alibaba-oss/src/main/docs/alibaba-oss-component.adoc +++ b/components/camel-alibaba/camel-alibaba-oss/src/main/docs/alibaba-oss-component.adoc @@ -123,7 +123,7 @@ In YAML, the object name is the `objectName` option, which the producer uses whe ---- ==== -Producer operations return structured response metadata in the message body (`Map` or `List<Map>` depending on the operation). +The `getObject` operation returns the content of the object as a `byte[]` in the message body, with its metadata in headers. `listObjects` and `listBuckets` return a `List<Map>`, and the other operations return the response metadata as a `Map`. === Consume objects from a bucket diff --git a/components/camel-alibaba/camel-alibaba-oss/src/main/java/org/apache/camel/component/alibaba/oss/OSSEndpoint.java b/components/camel-alibaba/camel-alibaba-oss/src/main/java/org/apache/camel/component/alibaba/oss/OSSEndpoint.java index e9d572c72dc2..145e3db28c38 100644 --- a/components/camel-alibaba/camel-alibaba-oss/src/main/java/org/apache/camel/component/alibaba/oss/OSSEndpoint.java +++ b/components/camel-alibaba/camel-alibaba-oss/src/main/java/org/apache/camel/component/alibaba/oss/OSSEndpoint.java @@ -23,6 +23,9 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.alibaba.common.models.ServiceKeys; import org.apache.camel.component.alibaba.oss.constants.OSSHeaders; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -35,6 +38,30 @@ import org.apache.camel.support.ScheduledPollEndpoint; @UriEndpoint(firstVersion = "4.23.0", scheme = "alibaba-oss", title = "Alibaba Object Storage Service (OSS)", syntax = "alibaba-oss:bucketName", category = { Category.CLOUD }, headersClass = OSSHeaders.class) +@BodyTypes(consumerOut = @BodyType(value = Carrier.BYTES, javaType = "byte[]", + description = "The content of the object as a byte array, one message per object, with" + + " its bucket, key and metadata in headers"), + producerIn = @BodyType(value = Carrier.ANY, + byOption = @BodyType.When(option = "operation", value = "putObject", + carriers = { + Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, + Carrier.FILE }), + description = "The content to upload for putObject: text, bytes, a stream or a file (a" + + " file without objectName is stored under its file name). A Map, a List" + + " or a POJO fails: marshal it first. The other operations do not read" + + " the body, they take their input from options and headers"), + producerOut = @BodyType(value = Carrier.MAP, + byOption = { + @BodyType.When(option = "operation", value = "getObject", carriers = Carrier.BYTES, + javaType = "byte[]"), + @BodyType.When(option = "operation", value = "listObjects", carriers = Carrier.LIST, + javaType = "java.util.List<java.util.Map<String, Object>>"), + @BodyType.When(option = "operation", value = "listBuckets", carriers = Carrier.LIST, + javaType = "java.util.List<java.util.Map<String, Object>>") }, + description = "A Map of the result for putObject, deleteObject, copyObject and" + + " headObject, such as the eTag and the status code. getObject gives the" + + " content of the object as a byte array with its metadata in headers," + + " listObjects and listBuckets a List of a Map per object or bucket")) public class OSSEndpoint extends ScheduledPollEndpoint { @UriPath(description = "Name of bucket to perform operation on", displayName = "Bucket Name") diff --git a/components/camel-alibaba/camel-alibaba-ots/src/generated/resources/META-INF/org/apache/camel/component/alibaba/ots/alibaba-ots.json b/components/camel-alibaba/camel-alibaba-ots/src/generated/resources/META-INF/org/apache/camel/component/alibaba/ots/alibaba-ots.json index 22e55f89d557..822fc4dcf5b7 100644 --- a/components/camel-alibaba/camel-alibaba-ots/src/generated/resources/META-INF/org/apache/camel/component/alibaba/ots/alibaba-ots.json +++ b/components/camel-alibaba/camel-alibaba-ots/src/generated/resources/META-INF/org/apache/camel/component/alibaba/ots/alibaba-ots.json @@ -33,6 +33,10 @@ "CamelAlibabaOtsOperation": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Operation override", "constantName": "org.apache.camel.component.alibaba.ots.constants.AlibabaOtsHeaders#OPERATION" }, "CamelAlibabaOtsRequestId": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Tablestore request id", "constantName": "org.apache.camel.component.alibaba.ots.constants.AlibabaOtsHeaders#REQUEST_ID" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "operation", "value": "putRow", "carriers": [ "pojo" ], "javaType": "com.alicloud.openservices.tablestore.model.PutRowRequest" }, { "option": "operation", "value": "getRow", "carriers": [ "pojo" ], "javaType": "com.alicloud.openservices.tablestore.model.GetRowRequest" }, { "option": "operation", "value": "updateRow", "carriers": [ "pojo" ], "javaType": "com.alicloud.openservices.tablestore.model.UpdateRowRequest" }, { " [...] + "producerOut": { "carriers": [ "map" ], "byOption": [ { "option": "operation", "value": "listTables", "carriers": [ "list" ], "javaType": "java.util.List<String>" } ], "description": "A Map of the response for the row operations: the requestId, the consumedCapacity and the row as a Map of its primaryKey and columns. listTables gives a List of the table names" } + }, "properties": { "operation": { "index": 0, "kind": "path", "displayName": "Operation", "group": "producer", "label": "producer", "required": true, "type": "enum", "javaType": "java.lang.String", "enum": [ "putRow", "getRow", "updateRow", "deleteRow", "listTables" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Operation to perform" }, "endpoint": { "index": 1, "kind": "parameter", "displayName": "Endpoint", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Tablestore endpoint URL" }, diff --git a/components/camel-alibaba/camel-alibaba-ots/src/main/java/org/apache/camel/component/alibaba/ots/AlibabaOtsEndpoint.java b/components/camel-alibaba/camel-alibaba-ots/src/main/java/org/apache/camel/component/alibaba/ots/AlibabaOtsEndpoint.java index c30ae6afe500..a666771b0d29 100644 --- a/components/camel-alibaba/camel-alibaba-ots/src/main/java/org/apache/camel/component/alibaba/ots/AlibabaOtsEndpoint.java +++ b/components/camel-alibaba/camel-alibaba-ots/src/main/java/org/apache/camel/component/alibaba/ots/AlibabaOtsEndpoint.java @@ -23,6 +23,9 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.alibaba.common.models.ServiceKeys; import org.apache.camel.component.alibaba.ots.constants.AlibabaOtsHeaders; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -35,6 +38,26 @@ import org.apache.camel.support.DefaultEndpoint; @UriEndpoint(firstVersion = "4.23.0", scheme = "alibaba-ots", title = "Alibaba Tablestore (OTS)", syntax = "alibaba-ots:operation", category = { Category.CLOUD, Category.DATABASE }, headersClass = AlibabaOtsHeaders.class, producerOnly = true) +@BodyTypes(producerIn = @BodyType(value = Carrier.ANY, + byOption = { + @BodyType.When(option = "operation", value = "putRow", carriers = Carrier.POJO, + javaType = "com.alicloud.openservices.tablestore.model.PutRowRequest"), + @BodyType.When(option = "operation", value = "getRow", carriers = Carrier.POJO, + javaType = "com.alicloud.openservices.tablestore.model.GetRowRequest"), + @BodyType.When(option = "operation", value = "updateRow", carriers = Carrier.POJO, + javaType = "com.alicloud.openservices.tablestore.model.UpdateRowRequest"), + @BodyType.When(option = "operation", value = "deleteRow", carriers = Carrier.POJO, + javaType = "com.alicloud.openservices.tablestore.model.DeleteRowRequest") }, + description = "The request of the Tablestore SDK for the row operations, such as a" + + " PutRowRequest for putRow: any other body fails. listTables does not" + + " read the body"), + producerOut = @BodyType(value = Carrier.MAP, + byOption = @BodyType.When(option = "operation", value = "listTables", + carriers = Carrier.LIST, + javaType = "java.util.List<String>"), + description = "A Map of the response for the row operations: the requestId, the" + + " consumedCapacity and the row as a Map of its primaryKey and columns." + + " listTables gives a List of the table names")) public class AlibabaOtsEndpoint extends DefaultEndpoint { @UriPath(description = "Operation to perform", displayName = "Operation", label = "producer", diff --git a/components/camel-alibaba/camel-alibaba-sls/src/generated/resources/META-INF/org/apache/camel/component/alibaba/sls/alibaba-sls.json b/components/camel-alibaba/camel-alibaba-sls/src/generated/resources/META-INF/org/apache/camel/component/alibaba/sls/alibaba-sls.json index e8de5894f643..1a457cc7a542 100644 --- a/components/camel-alibaba/camel-alibaba-sls/src/generated/resources/META-INF/org/apache/camel/component/alibaba/sls/alibaba-sls.json +++ b/components/camel-alibaba/camel-alibaba-sls/src/generated/resources/META-INF/org/apache/camel/component/alibaba/sls/alibaba-sls.json @@ -48,6 +48,10 @@ "CamelAlibabaSlsRequestId": { "index": 15, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Alibaba Cloud request id", "constantName": "org.apache.camel.component.alibaba.sls.constants.AlibabaSlsHeaders#REQUEST_ID" }, "CamelAlibabaSlsStatusCode": { "index": 16, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "HTTP status code from SLS response", "constantName": "org.apache.camel.component.alibaba.sls.constants.AlibabaSlsHeaders#STATUS_CODE" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "operation", "value": "putLogs", "carriers": [ "pojo" ] } ], "description": "The logs to write for putLogs: a LogGroup or a PutLogsRequest of the SLS SDK, any other body fails. getLogs and listLogStores do not read the body, they take their input from options and headers" }, + "producerOut": { "carriers": [ "map" ], "description": "A Map of the response with its statusCode and headers. For getLogs the GetLogsResponseBody of the SLS SDK is under body, for listLogStores the names under logstores with count and total" } + }, "properties": { "operation": { "index": 0, "kind": "path", "displayName": "Operation", "group": "producer", "label": "producer", "required": true, "type": "enum", "javaType": "java.lang.String", "enum": [ "putLogs", "getLogs", "listLogStores" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Operation to perform" }, "endpoint": { "index": 1, "kind": "parameter", "displayName": "Endpoint", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "SLS endpoint URL (e.g. cn-hangzhou.log.aliyuncs.com). Carries higher precedence than region based client initialization" }, diff --git a/components/camel-alibaba/camel-alibaba-sls/src/main/docs/alibaba-sls-component.adoc b/components/camel-alibaba/camel-alibaba-sls/src/main/docs/alibaba-sls-component.adoc index cd37f8245ac0..cd11cd6fa40b 100644 --- a/components/camel-alibaba/camel-alibaba-sls/src/main/docs/alibaba-sls-component.adoc +++ b/components/camel-alibaba/camel-alibaba-sls/src/main/docs/alibaba-sls-component.adoc @@ -54,7 +54,7 @@ The component supports the following operations: === Producer examples -Put logs: +Put logs, where the message body must be a `LogGroup` or a `PutLogsRequest` of the SLS SDK (any other body fails): [tabs] ==== diff --git a/components/camel-alibaba/camel-alibaba-sls/src/main/java/org/apache/camel/component/alibaba/sls/AlibabaSlsEndpoint.java b/components/camel-alibaba/camel-alibaba-sls/src/main/java/org/apache/camel/component/alibaba/sls/AlibabaSlsEndpoint.java index 2d74d628e5c9..bb207583131a 100644 --- a/components/camel-alibaba/camel-alibaba-sls/src/main/java/org/apache/camel/component/alibaba/sls/AlibabaSlsEndpoint.java +++ b/components/camel-alibaba/camel-alibaba-sls/src/main/java/org/apache/camel/component/alibaba/sls/AlibabaSlsEndpoint.java @@ -23,6 +23,9 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.alibaba.common.models.ServiceKeys; import org.apache.camel.component.alibaba.sls.constants.AlibabaSlsHeaders; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -35,6 +38,15 @@ import org.apache.camel.support.DefaultEndpoint; @UriEndpoint(firstVersion = "4.23.0", scheme = "alibaba-sls", title = "Alibaba Simple Log Service (SLS)", syntax = "alibaba-sls:operation", category = { Category.CLOUD, Category.MONITORING }, headersClass = AlibabaSlsHeaders.class, producerOnly = true) +@BodyTypes(producerIn = @BodyType(value = Carrier.ANY, + byOption = @BodyType.When(option = "operation", value = "putLogs", carriers = Carrier.POJO), + description = "The logs to write for putLogs: a LogGroup or a PutLogsRequest of the SLS" + + " SDK, any other body fails. getLogs and listLogStores do not read the" + + " body, they take their input from options and headers"), + producerOut = @BodyType(value = Carrier.MAP, + description = "A Map of the response with its statusCode and headers. For getLogs the" + + " GetLogsResponseBody of the SLS SDK is under body, for listLogStores" + + " the names under logstores with count and total")) public class AlibabaSlsEndpoint extends DefaultEndpoint { @UriPath(description = "Operation to perform", displayName = "Operation", label = "producer", diff --git a/components/camel-alibaba/camel-alibaba-sms/src/generated/resources/META-INF/org/apache/camel/component/alibaba/sms/alibaba-sms.json b/components/camel-alibaba/camel-alibaba-sms/src/generated/resources/META-INF/org/apache/camel/component/alibaba/sms/alibaba-sms.json index 8c4420bf7e85..45992f320ac7 100644 --- a/components/camel-alibaba/camel-alibaba-sms/src/generated/resources/META-INF/org/apache/camel/component/alibaba/sms/alibaba-sms.json +++ b/components/camel-alibaba/camel-alibaba-sms/src/generated/resources/META-INF/org/apache/camel/component/alibaba/sms/alibaba-sms.json @@ -37,6 +37,10 @@ "CamelAlibabaSmsOutId": { "index": 4, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Out id for the SMS", "constantName": "org.apache.camel.component.alibaba.sms.constants.SMSHeaders#OUT_ID" }, "CamelAlibabaSmsRequestId": { "index": 5, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Alibaba Cloud request id", "constantName": "org.apache.camel.component.alibaba.sms.constants.SMSHeaders#REQUEST_ID" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "description": "Not used: sendSms takes the phone numbers, sign name, template code and template parameters from options or headers, such as CamelAlibabaSmsTemplateParam" }, + "producerOut": { "carriers": [ "map" ], "description": "A Map of the response: the statusCode, and the code, message, bizId and requestId the service returns" } + }, "properties": { "operation": { "index": 0, "kind": "path", "displayName": "Operation", "group": "producer", "label": "producer", "required": true, "type": "enum", "javaType": "java.lang.String", "enum": [ "sendSms" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Operation to perform" }, "endpoint": { "index": 1, "kind": "parameter", "displayName": "Endpoint", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "SMS endpoint URL. Carries higher precedence than region based client initialization" }, diff --git a/components/camel-alibaba/camel-alibaba-sms/src/main/java/org/apache/camel/component/alibaba/sms/SMSEndpoint.java b/components/camel-alibaba/camel-alibaba-sms/src/main/java/org/apache/camel/component/alibaba/sms/SMSEndpoint.java index 5e71ab6449b9..0f845f6b005b 100644 --- a/components/camel-alibaba/camel-alibaba-sms/src/main/java/org/apache/camel/component/alibaba/sms/SMSEndpoint.java +++ b/components/camel-alibaba/camel-alibaba-sms/src/main/java/org/apache/camel/component/alibaba/sms/SMSEndpoint.java @@ -23,6 +23,9 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.alibaba.common.models.ServiceKeys; import org.apache.camel.component.alibaba.sms.constants.SMSHeaders; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -35,6 +38,13 @@ import org.apache.camel.support.DefaultEndpoint; @UriEndpoint(firstVersion = "4.23.0", scheme = "alibaba-sms", title = "Alibaba Short Message Service (SMS)", syntax = "alibaba-sms:operation", category = { Category.CLOUD, Category.MESSAGING }, headersClass = SMSHeaders.class, producerOnly = true) +@BodyTypes(producerIn = @BodyType(value = Carrier.ANY, + description = "Not used: sendSms takes the phone numbers, sign name, template code and" + + " template parameters from options or headers, such as" + + " CamelAlibabaSmsTemplateParam"), + producerOut = @BodyType(value = Carrier.MAP, + description = "A Map of the response: the statusCode, and the code, message, bizId and" + + " requestId the service returns")) public class SMSEndpoint extends DefaultEndpoint { @UriPath(description = "Operation to perform", displayName = "Operation", label = "producer", diff --git a/components/camel-consul/src/generated/resources/META-INF/org/apache/camel/component/consul/consul.json b/components/camel-consul/src/generated/resources/META-INF/org/apache/camel/component/consul/consul.json index 9c757e17dfd9..5e1b82d6b738 100644 --- a/components/camel-consul/src/generated/resources/META-INF/org/apache/camel/component/consul/consul.json +++ b/components/camel-consul/src/generated/resources/META-INF/org/apache/camel/component/consul/consul.json @@ -84,6 +84,11 @@ "CamelConsulPreparedQueryID": { "index": 29, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The id of the prepared query", "constantName": "org.apache.camel.component.consul.ConsulConstants#CONSUL_PREPARED_QUERY_ID" }, "CamelConsulServiceId": { "index": 30, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The service id for agent deregistration", "constantName": "org.apache.camel.component.consul.ConsulConstants#CONSUL_SERVICE_ID" } }, + "bodyTypes": { + "consumerOut": { "carriers": [ "text", "null" ], "description": "The kv consumer: the value of the key (of each key under it with recursive) base64 encoded as Consul stores it, decoded with valueAsString=true, with the key, flags and indexes in headers; null for a key without value. The event consumer: the payload of the event as text, with its name and id in headers" }, + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "action", "value": "PUT", "carriers": [ "text", "bytes", "stream", "file", "value", "null" ] }, { "option": "action", "value": "LOCK", "carriers": [ "text", "bytes", "stream", "file", "value", "null" ] }, { "option": "action", "value": "FIRE", "carriers": [ "text", "bytes", "stream", "file", "value" ] }, { "option": "action", "value": "REGISTER", "carriers": [ "pojo" ] }, { "option": "action", "value": "CREATE", "carrie [...] + "producerOut": { "carriers": [ "pojo", "list", "map", "text", "unchanged" ], "byOption": [ { "option": "action", "value": "CHECKS", "carriers": [ "map", "list" ] }, { "option": "action", "value": "SERVICES", "carriers": [ "map" ] }, { "option": "action", "value": "MEMBERS", "carriers": [ "list" ] }, { "option": "action", "value": "AGENT", "carriers": [ "pojo" ], "javaType": "org.kiwiproject.consul.model.agent.Agent" }, { "option": "action", "value": "REGISTER", "carriers": [ "unchang [...] + }, "properties": { "apiEndpoint": { "index": 0, "kind": "path", "displayName": "Api Endpoint", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The API endpoint" }, "connectTimeout": { "index": 1, "kind": "parameter", "displayName": "Connect Timeout", "group": "common", "label": "", "required": false, "type": "duration", "javaType": "java.time.Duration", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.consul.ConsulConfiguration", "configurationField": "configuration", "description": "Connect timeout" }, diff --git a/components/camel-consul/src/main/docs/consul-component.adoc b/components/camel-consul/src/main/docs/consul-component.adoc index 15151ff16cdf..1b8a97222470 100644 --- a/components/camel-consul/src/main/docs/consul-component.adoc +++ b/components/camel-consul/src/main/docs/consul-component.adoc @@ -101,8 +101,8 @@ consul:agent?action=REGISTER The `kv` endpoint reads and writes the key-value store of Consul. The action comes from the `action` option or the `CamelConsulAction` header (the header wins), and the key from the `key` option or the `CamelConsulKey` header. -A PUT stores the message body as the value. A GET_VALUE sets the value as the message body, and `valueAsString` -makes it a string: +A PUT stores the message body, converted to a string, as the value. A GET_VALUE sets the `Value` of the Consul client +as the message body, which holds the value base64 encoded, and `valueAsString` makes the body the value as a string: [source,yaml] ---- @@ -139,6 +139,7 @@ makes it a string: A consumer of the `kv` endpoint watches a key with a blocking query of `blockSeconds` (10 by default). The route gets the value each time the query returns: when the value changes, or when the wait ends. +The body is the value base64 encoded, as Consul stores it, unless `valueAsString` is set. [source,yaml] ---- diff --git a/components/camel-consul/src/main/java/org/apache/camel/component/consul/ConsulEndpoint.java b/components/camel-consul/src/main/java/org/apache/camel/component/consul/ConsulEndpoint.java index 55c94a14b649..798e4155ea8c 100644 --- a/components/camel-consul/src/main/java/org/apache/camel/component/consul/ConsulEndpoint.java +++ b/components/camel-consul/src/main/java/org/apache/camel/component/consul/ConsulEndpoint.java @@ -22,6 +22,9 @@ import org.apache.camel.Category; import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -35,6 +38,92 @@ import org.kiwiproject.consul.Consul; */ @UriEndpoint(firstVersion = "2.18.0", scheme = "consul", title = "Consul", syntax = "consul:apiEndpoint", category = { Category.CLOUD, Category.API }, headersClass = ConsulConstants.class) +@BodyTypes(consumerOut = @BodyType(value = { Carrier.TEXT, Carrier.NULL }, + description = "The kv consumer: the value of the key (of each key under it with recursive)" + + " base64 encoded as Consul stores it, decoded with valueAsString=true, with the" + + " key, flags and indexes in headers; null for a key without value. The event" + + " consumer: the payload of the event as text, with its name and id in headers"), + producerIn = @BodyType(value = Carrier.ANY, + byOption = { + @BodyType.When(option = "action", value = "PUT", + carriers = { + Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, Carrier.FILE, + Carrier.VALUE, Carrier.NULL }), + @BodyType.When(option = "action", value = "LOCK", + carriers = { + Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, Carrier.FILE, + Carrier.VALUE, Carrier.NULL }), + @BodyType.When(option = "action", value = "FIRE", carriers = { + Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, Carrier.FILE, Carrier.VALUE }), + @BodyType.When(option = "action", value = "REGISTER", carriers = Carrier.POJO), + @BodyType.When(option = "action", value = "CREATE", carriers = Carrier.POJO) }, + description = "PUT and LOCK store the body converted to text as the value, and FIRE sends it" + + " as the payload: a Map or a POJO is stored as its toString, so marshal it" + + " first. REGISTER, DEREGISTER of catalog and CREATE take the model object of" + + " the Consul client, such as a Registration or a Session; the session and" + + " prepared query actions read the id from the body when its header is not set;" + + " the other actions take their input from headers"), + producerOut = @BodyType(value = { Carrier.POJO, Carrier.LIST, Carrier.MAP, Carrier.TEXT, Carrier.UNCHANGED }, + byOption = { + @BodyType.When(option = "action", value = "CHECKS", + carriers = { Carrier.MAP, Carrier.LIST }), + @BodyType.When(option = "action", value = "SERVICES", carriers = Carrier.MAP), + @BodyType.When(option = "action", value = "MEMBERS", carriers = Carrier.LIST), + @BodyType.When(option = "action", value = "AGENT", carriers = Carrier.POJO, + javaType = "org.kiwiproject.consul.model.agent.Agent"), + @BodyType.When(option = "action", value = "REGISTER", carriers = Carrier.UNCHANGED), + @BodyType.When(option = "action", value = "DEREGISTER", + carriers = Carrier.UNCHANGED), + @BodyType.When(option = "action", value = "PUT", carriers = Carrier.UNCHANGED), + @BodyType.When(option = "action", value = "GET_VALUE", + carriers = { Carrier.POJO, Carrier.TEXT, Carrier.UNCHANGED }), + @BodyType.When(option = "action", value = "GET_VALUES", carriers = Carrier.LIST), + @BodyType.When(option = "action", value = "GET_KEYS", carriers = Carrier.LIST), + @BodyType.When(option = "action", value = "GET_SESSIONS", carriers = Carrier.POJO, + javaType = "java.util.Optional<java.lang.String>"), + @BodyType.When(option = "action", value = "DELETE_KEY", + carriers = Carrier.UNCHANGED), + @BodyType.When(option = "action", value = "DELETE_KEYS", + carriers = Carrier.UNCHANGED), + @BodyType.When(option = "action", value = "LOCK", carriers = Carrier.UNCHANGED), + @BodyType.When(option = "action", value = "UNLOCK", carriers = Carrier.UNCHANGED), + @BodyType.When(option = "action", value = "LIST_DATACENTERS", + carriers = Carrier.LIST), + @BodyType.When(option = "action", value = "LIST_NODES", carriers = Carrier.LIST), + @BodyType.When(option = "action", value = "LIST_SERVICES", carriers = Carrier.MAP), + @BodyType.When(option = "action", value = "GET_SERVICE", carriers = Carrier.LIST), + @BodyType.When(option = "action", value = "GET_NODE", carriers = Carrier.POJO, + javaType = "org.kiwiproject.consul.model.catalog.CatalogNode"), + @BodyType.When(option = "action", value = "NODE_CHECKS", carriers = Carrier.LIST), + @BodyType.When(option = "action", value = "SERVICE_CHECKS", carriers = Carrier.LIST), + @BodyType.When(option = "action", value = "SERVICE_INSTANCES", + carriers = Carrier.LIST), + @BodyType.When(option = "action", value = "CREATE", + carriers = { Carrier.POJO, Carrier.TEXT }), + @BodyType.When(option = "action", value = "DESTROY", carriers = Carrier.UNCHANGED), + @BodyType.When(option = "action", value = "INFO", + carriers = { Carrier.POJO, Carrier.UNCHANGED }), + @BodyType.When(option = "action", value = "LIST", + carriers = { Carrier.POJO, Carrier.LIST }), + @BodyType.When(option = "action", value = "RENEW", carriers = Carrier.POJO, + javaType = "java.util.Optional<org.kiwiproject.consul.model.session.SessionInfo>"), + @BodyType.When(option = "action", value = "GET", carriers = Carrier.POJO, + javaType = "java.util.Optional<org.kiwiproject.consul.model.query.StoredQuery>"), + @BodyType.When(option = "action", value = "EXECUTE", carriers = Carrier.POJO, + javaType = "org.kiwiproject.consul.model.query.QueryResults"), + @BodyType.When(option = "action", value = "FIRE", carriers = Carrier.POJO, + javaType = "org.kiwiproject.consul.model.event.Event"), + @BodyType.When(option = "action", value = "DATACENTERS", carriers = Carrier.LIST), + @BodyType.When(option = "action", value = "NODES", carriers = Carrier.LIST), + @BodyType.When(option = "action", value = "LEADER", carriers = Carrier.TEXT, + javaType = "java.lang.String"), + @BodyType.When(option = "action", value = "PEERS", carriers = Carrier.LIST) }, + description = "The response of Consul as the model objects of the Consul client: a List or a" + + " Map of them for the list actions, the Value of the key for GET_VALUE (its value" + + " base64 encoded) or the value as text with valueAsString=true, and the Event" + + " for FIRE. Unchanged for the actions that only write (PUT, the deletes, LOCK," + + " UNLOCK, REGISTER, DEREGISTER, DESTROY) and when nothing is found, with" + + " the outcome in the CamelConsulResult header")) public class ConsulEndpoint extends DefaultEndpoint { @UriParam diff --git a/components/camel-dapr/src/generated/resources/META-INF/org/apache/camel/component/dapr/dapr.json b/components/camel-dapr/src/generated/resources/META-INF/org/apache/camel/component/dapr/dapr.json index d590402e4d10..a5886881c019 100644 --- a/components/camel-dapr/src/generated/resources/META-INF/org/apache/camel/component/dapr/dapr.json +++ b/components/camel-dapr/src/generated/resources/META-INF/org/apache/camel/component/dapr/dapr.json @@ -125,6 +125,11 @@ "CamelDaprTimeout": { "index": 56, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Duration", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The amount of time to wait for the workflow instance to start\/complete", "constantName": "org.apache.camel.component.dapr.DaprConstants#TIMEOUT" }, "CamelDaprEventName": { "index": 57, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The name of the event. Event names are case-insensitive", "constantName": "org.apache.camel.component.dapr.DaprConstants#EVENT_NAME" } }, + "bodyTypes": { + "consumerOut": { "carriers": [ "bytes", "map" ], "byOption": [ { "option": "operation", "value": "pubSub", "carriers": [ "bytes" ], "javaType": "byte[]" }, { "option": "operation", "value": "configuration", "carriers": [ "map" ], "javaType": "java.util.Map<java.lang.String, java.lang.String>" } ], "description": "For pubSub the data of the cloud event as bytes, with its id, type, source and content type in headers. For configuration a Map of the changed keys and their values, with th [...] + "producerIn": { "carriers": [ "text", "bytes", "value", "map", "list", "pojo", "null" ], "description": "The data of invokeService, pubSub, invokeBinding, state save and the workflow input, event and output, given to the Dapr client as is: bytes are sent as they are, other bodies are serialized as JSON (text as a JSON string), and a stream fails: convert it to bytes first. State save needs a body; the other operations do not read it" }, + "producerOut": { "carriers": [ "bytes", "pojo", "list", "map", "value", "unchanged", "null" ], "byOption": [ { "option": "operation", "value": "invokeService", "carriers": [ "bytes", "null" ] }, { "option": "operation", "value": "invokeBinding", "carriers": [ "bytes", "null" ] }, { "option": "operation", "value": "pubSub", "carriers": [ "pojo" ], "javaType": "io.dapr.client.domain.PublishEventRequest" }, { "option": "operation", "value": "state", "carriers": [ "pojo", "list" ] }, { " [...] + }, "properties": { "operation": { "index": 0, "kind": "path", "displayName": "Operation", "group": "producer", "label": "producer", "required": true, "type": "enum", "javaType": "org.apache.camel.component.dapr.DaprOperation", "enum": [ "invokeService", "state", "pubSub", "invokeBinding", "secret", "configuration", "lock", "workflow" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.dapr.DaprConfiguration", "configurati [...] "client": { "index": 1, "kind": "parameter", "displayName": "Client", "group": "common", "label": "common", "required": false, "type": "object", "javaType": "io.dapr.client.DaprClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.dapr.DaprConfiguration", "configurationField": "configuration", "description": "The Dapr Client" }, diff --git a/components/camel-dapr/src/main/java/org/apache/camel/component/dapr/DaprEndpoint.java b/components/camel-dapr/src/main/java/org/apache/camel/component/dapr/DaprEndpoint.java index 8a36b43f6842..e26df32354e3 100644 --- a/components/camel-dapr/src/main/java/org/apache/camel/component/dapr/DaprEndpoint.java +++ b/components/camel-dapr/src/main/java/org/apache/camel/component/dapr/DaprEndpoint.java @@ -26,6 +26,9 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.dapr.consumer.DaprConfigurationConsumer; import org.apache.camel.component.dapr.consumer.DaprPubSubConsumer; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.HeaderFilterStrategy; import org.apache.camel.spi.HeaderFilterStrategyAware; import org.apache.camel.spi.UriEndpoint; @@ -39,6 +42,49 @@ import org.slf4j.LoggerFactory; */ @UriEndpoint(firstVersion = "4.12.0", scheme = "dapr", title = "Dapr", syntax = "dapr:operation", category = { Category.CLOUD, Category.SAAS }, headersClass = DaprConstants.class) +@BodyTypes(consumerOut = @BodyType(value = { Carrier.BYTES, Carrier.MAP }, + byOption = { + @BodyType.When(option = "operation", value = "pubSub", carriers = Carrier.BYTES, + javaType = "byte[]"), + @BodyType.When(option = "operation", value = "configuration", + carriers = Carrier.MAP, + javaType = "java.util.Map<java.lang.String, java.lang.String>") }, + description = "For pubSub the data of the cloud event as bytes, with its id, type, source and" + + " content type in headers. For configuration a Map of the changed keys and" + + " their values, with the ConfigurationItems in the CamelDaprRawConfigResponse" + + " header"), + producerIn = @BodyType(value = { + Carrier.TEXT, Carrier.BYTES, Carrier.VALUE, Carrier.MAP, Carrier.LIST, Carrier.POJO, Carrier.NULL }, + description = "The data of invokeService, pubSub, invokeBinding, state save and the workflow" + + " input, event and output, given to the Dapr client as is: bytes are sent as" + + " they are, other bodies are serialized as JSON (text as a JSON string), and a" + + " stream fails: convert it to bytes first. State save needs a body; the other" + + " operations do not read it"), + producerOut = @BodyType(value = { + Carrier.BYTES, Carrier.POJO, Carrier.LIST, Carrier.MAP, Carrier.VALUE, Carrier.UNCHANGED, Carrier.NULL }, + byOption = { + @BodyType.When(option = "operation", value = "invokeService", + carriers = { Carrier.BYTES, Carrier.NULL }), + @BodyType.When(option = "operation", value = "invokeBinding", + carriers = { Carrier.BYTES, Carrier.NULL }), + @BodyType.When(option = "operation", value = "pubSub", carriers = Carrier.POJO, + javaType = "io.dapr.client.domain.PublishEventRequest"), + @BodyType.When(option = "operation", value = "state", + carriers = { Carrier.POJO, Carrier.LIST }), + @BodyType.When(option = "operation", value = "secret", carriers = Carrier.MAP), + @BodyType.When(option = "operation", value = "configuration", + carriers = Carrier.MAP, + javaType = "java.util.Map<java.lang.String, java.lang.String>"), + @BodyType.When(option = "operation", value = "lock", carriers = Carrier.VALUE), + @BodyType.When(option = "operation", value = "workflow", + carriers = { Carrier.POJO, Carrier.UNCHANGED, Carrier.NULL }) }, + description = "The response as bytes for invokeService and invokeBinding (null when there" + + " is none), the PublishEventRequest for pubSub, the State for state get and" + + " save, a List of State for getBulk and the request for the other state" + + " operations, a Map for secret and configuration, true or false for tryLock" + + " and the UnlockResponseStatus for unlock. For workflow the" + + " NewWorkflowOptions for scheduleNew, the WorkflowState for state and the" + + " waits, unchanged for terminate and raiseEvent, and null otherwise")) public class DaprEndpoint extends DefaultEndpoint implements HeaderFilterStrategyAware { private static final Logger LOG = LoggerFactory.getLogger(DaprEndpoint.class);
