This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch message-timestamp-router-action in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git
commit a6d1987fec52934a802e60bb3a414f0df0647252 Author: Andrea Cosentino <[email protected]> AuthorDate: Wed May 19 08:46:02 2021 +0200 Added Message Timestamp Router action to Catalog --- .../message-timestamp-router-action.kamelet.yaml | 73 ++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/library/camel-kamelets-catalog/src/main/resources/kamelets/message-timestamp-router-action.kamelet.yaml b/library/camel-kamelets-catalog/src/main/resources/kamelets/message-timestamp-router-action.kamelet.yaml new file mode 100644 index 0000000..fcc9e8e --- /dev/null +++ b/library/camel-kamelets-catalog/src/main/resources/kamelets/message-timestamp-router-action.kamelet.yaml @@ -0,0 +1,73 @@ +apiVersion: camel.apache.org/v1alpha1 +kind: Kamelet +metadata: + name: message-timestamp-router-action + labels: + camel.apache.org/kamelet.type: "action" + annotations: + camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgeG1sbnM6c29kaXBvZGk9Imh0dHA6Ly9zb2RpcG [...] + camel.apache.org/provider: "Apache Software Foundation" +spec: + definition: + title: "Timestamp Router Action" + description: "Update the topic field as a function of the original topic name and the record's timestamp field." + required: + - timestampKeys + properties: + topicFormat: + title: Topic Format + description: Format string which can contain '$[topic]' and '$[timestamp]' as placeholders for the topic and timestamp, respectively. + type: string + default: "topic-$[timestamp]" + timestampFormat: + title: Timestamp Format + description: Format string for the timestamp that is compatible with java.text.SimpleDateFormat. + type: string + default: "yyyyMMdd" + timestampKeys: + title: Timestamp Keys + description: Comma separated list of Timestamp keys. The timestamp is taken from the first found field. + type: string + timestampKeyFormat: + title: Timestamp Keys Format + description: Format of the timestamp keys. Possible values are 'timestamp' or any format string for the timestamp that is compatible with java.text.SimpleDateFormat. In case of 'timestamp' the field will be evaluated as milliseconds since 1970, so as a UNIX Timestamp. + type: string + default: "timestamp" + type: object + dependencies: + - github:apache.camel-kamelets:camel-kamelets-utils:main-SNAPSHOT + - "camel:jackson" + - "camel:kamelet" + - "camel:core" + flow: + from: + uri: kamelet:source + steps: + - choice: + when: + - simple: "${header[Content-Type]} == 'application/json'" + steps: + - unmarshal: + json: + library: Jackson + unmarshalTypeName: com.fasterxml.jackson.databind.JsonNode + - set-property: + name: "topicFormat" + constant: "{{topicFormat}}" + - set-property: + name: "timestampFormat" + constant: "{{timestampFormat}}" + - set-property: + name: "timestampKeys" + constant: "{{timestampKeys}}" + - set-property: + name: "timestampKeyFormat" + constant: "{{timestampKeyFormat}}" + - bean: "org.apache.camel.kamelets.utils.transform.MessageTimestampRouter" + - marshal: + json: + library: Jackson + unmarshalTypeName: com.fasterxml.jackson.databind.JsonNode + - set-header: + name: "Content-Type" + constant: "application/json"
