-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Add data-type-action Kamelet #1328
Conversation
christophd
commented
Mar 1, 2023
- Adds new action Kamelet to leverage Kamelet input/ouput data types
- Enables users to apply data type conversion as part of a KameletBinding
- Introduces new data type implementation representing the CloudEvents Http binding
- Add some YAKS tests to verify data-type-action Kamelet
- Use Kamelets from local directory when running YAKS tests in GitHub workflow
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: 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 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):
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. apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: aws-s3-to-http
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: aws-s3-source
properties:
bucketNameOrArn: someBucket
[...]
steps:
- ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: data-type-action
properties:
scheme: "aws2-s3"
format: "cloudevents"
- ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: data-type-action
properties:
scheme: "http"
format: "cloudevents"
sink:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: http-sink
properties:
url: http:://test-service/incoming |
3874367
to
a1ea00e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really important: we could avoid modifying the current kamelets code and leave the choice oto the user to use or not use the action.
I think the next step should be removing the experimental kamelets then.
After that we should see if we might need to create more beans for all the supported kamelets to use in this action. But I need to dig a bit more
Does this sounds correct to you?
@oscerd Yes, sounds good, many thanks. I will prepare a PR to remove the experimental Kamelets as a next step |
still not sure about the name 'data-type-action' though. Something like 'apply-data-type-action' would be a bit long. any ideas? |
a1ea00e
to
116655a
Compare
maybe data-type-transform-action? |
0b3a9bb
to
95f46fe
Compare
- Adds new action Kamelet to leverage Kamelet input/ouput data types - Enables users to apply data type conversion as part of a KameletBinding - Introduces new data type implementation representing the CloudEvents Http binding - Add some YAKS tests to verify data-type-action Kamelet - Use Kamelets from local directory when running YAKS tests in GitHub workflow
95f46fe
to
893573a
Compare