[DO NOT MERGE YET] GH-3103: Introduce CloudEvents transformers
Fixes https://github.com/spring-projects/spring-integration/issues/3103
- Add an
io.cloudevents:cloudevents-apioptional dependency - Introduce a
HeaderMapperandMarshallersin thesupport.cloudeventsto marshalCloudEventinstances - Introduce a
ToCloudEventTransformerto build aCloudEventinstance from aMessageand optional marshaling logic if necessary. Such a transformer could be used as a general purpose CE protocol binder before sending a result message into the target protocol channel adapter
Rather than implement this yourself, you should come help fix https://github.com/cloudevents/sdk-java
Rather than implement this yourself, you should come help fix
I'm not sure what you suggest us to fix over there since here we try to come up with some framework-specific tool which should help end-users to deal with CE well-know Spring Integration way.
Thank you for all your feedback!
Now we have something else to think about 😄
ok it sounds like I misunderstood this, you are not implementing for HTTP, but for some custom Message<> type and you are free to use any method to add prefix (or no prefix if you don't need them).
In that case you might consider writing a small spec with this PR to allow others to also implement the same choices you are making for Message<>. We had to do this for PubSub to be spec compliant: https://github.com/google/knative-gcp/blob/master/docs/spec/pubsub-protocol-binding.md
And this now lets pubsub be linked from the CloudEvents spec: https://github.com/cloudevents/spec/blob/master/proprietary-specs.md
It would be pretty neat to have Spring in that list too!