lightbend / kalix-jvm-sdk

Java and Scala SDKs for Kalix
https://docs.kalix.io/java/index.html
Other
58 stars 39 forks source link

Document and improve topic message type handling #715

Open johanandren opened 3 years ago

johanandren commented 3 years ago

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:

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.

raboof commented 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