spring-integration icon indicating copy to clipboard operation
spring-integration copied to clipboard

[DO NOT MERGE YET] GH-3103: Introduce CloudEvents transformers

Open artembilan opened this issue 5 years ago • 3 comments

Fixes https://github.com/spring-projects/spring-integration/issues/3103

  • Add an io.cloudevents:cloudevents-api optional dependency
  • Introduce a HeaderMapper and Marshallers in the support.cloudevents to marshal CloudEvent instances
  • Introduce a ToCloudEventTransformer to build a CloudEvent instance from a Message and 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

artembilan avatar Apr 09 '20 22:04 artembilan

Rather than implement this yourself, you should come help fix https://github.com/cloudevents/sdk-java

n3wscott avatar Apr 09 '20 22:04 n3wscott

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 😄

artembilan avatar Apr 10 '20 01:04 artembilan

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!

n3wscott avatar Apr 10 '20 14:04 n3wscott