christophd commented on PR #1328:
URL: https://github.com/apache/camel-kamelets/pull/1328#issuecomment-1450735347
Let me explain a bit on these changes. With the new data-type action Kamelet
users are able to explicitly apply a given data type conversion in a Kamelet
Binding:
```yaml
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: data-type-action-binding
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: timer-source
properties:
period: 5000
contentType: application/json
message: >
${input}
steps:
- ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: data-type-action
properties:
scheme: "http"
format: "cloudevents"
sink:
uri: http://test-service/result
```
Here for example the data type applies the [Http CloudEvents
binding](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/bindings/http-protocol-binding.md)
on a timer-source event. The data type is able to work with Camel specific
CloudEvent headers and also sets some CloudEvents defaults. The resulting Http
request looks like this (with proper CloudEvents headers set):
```
POST /someresource HTTP/1.1
Host: webhook.example.com
ce-specversion: 1.0
ce-type: org.apache.camel.event
ce-time: {{exchange-timestamp}}
ce-id: {(exchange-id})
ce-source: org.apache.camel
Content-Type: application/json; charset=utf-8
Content-Length: xxx
{
... application data ...
}
```
The combination with other data types (e.g. AWS-S3 Cloudevents data tpye)
creates proper CloudEvent data from AWS-S3 to Http for example where the AWS-S3
data type creates proper Camel CloudEvents headers on the exchange and the Http
CloudEvents data type translates these to proper Http headers.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]