Open johanandren opened 3 years ago
Current Kafka integration looks for a message attribute called ce-datacontenttype
Looks like that's consistent with the 'binary content mode' of the kafka-cloudevent binding spec, https://github.com/cloudevents/spec/blob/v1.0.1/kafka-protocol-binding.md#3231-property-names
Comes out of the #691 investigation
We have no mention at all in the documentation on how events coming from topics are handled with regard to the payload type.
Since the switch from annotation driven method resolution we also do not support all "raw" message types that may come from a topic into Akka Serverless.
Some detective work results:
Content-Type
attribute in their protocolce-datacontenttype
application/octet-stream
application/json
orapplication/something+json
it is encoded as Any with the type_urljson.akkaserverless.com/
+ cloud event "type" field (empty if not present)text/plain; charset=utf-8
it is encoded asp.akkaserverless.com/string
application/octet-stream
it is encoded asp.akkaserverless.com/bytes
We should document how these message types are passed on and or handled by default, per supported broker in the docs.
The old reflection based Java SDK had support for making a parameter or return type have String, protobuf ByteString or a Jackson Annotated type as parameter and the serialization in the SDK handling our internal representations of those types.
We currently have JSON covered by accepting proto
Any
and provide an explicit conversion. For ByteStrings and raw Strings this feels a bit more clunky but maybe we should make similar utilities for those.