Consume and Produce a Cloudevent Specification Message #515
Unanswered
davidxavier77
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
i am currently in an Organization where the message format used is Cloudevents (https://github.com/cloudevents/spec) .
We are putting multiple event types into the same topic. Each event is a cloudevent byte representation. They contain the event name in the header. The event name will be used eventually when deserializing it back into the dotnet type.
When using Kafkaflow what would be the best way to consume/produce these messages?
Cloudevent is not a serializable object so it will need it to be a byte representation.
Does it make sense that i make a middleware that will write the cloudevent byte representation directly to Kafka and then read the same as a Byte array
or
Does it make sense to build a deserializer middleware that will read the cloudevent type specification and then use a custom type resolver to convert the object back to the right type.
what would be the right approach to use? I want to be able to play nice with other middleware :)
Some other supporting documentation on Cloudevents https://github.com/cloudevents/sdk-csharp
"The CloudEvent class is not meant to be used with object serializers like JSON.NET. If you need to serialize or deserialize a CloudEvent directly, always use a CloudEventFormatter such as JsonEventFormatter."
Beta Was this translation helpful? Give feedback.
All reactions