cloudevents / sdk-python

Python SDK for CloudEvents
https://pypi.org/p/cloudevents/
Apache License 2.0
279 stars 55 forks source link

feat: Kafka Protocol #197

Closed davidwmartines closed 1 year ago

davidwmartines commented 1 year ago

Signed-off-by: davidwmartines d5172@yahoo.com

Fixes #196

Changes

This PR adds functions for converting CloudEvents to Kakfa-protocol-ready objects, and for converting Kafka-protocol messages into CloudEvents, per the CloudEvents Kafka protocol binding spec.

Add Kafka Protocol support

davidwmartines commented 1 year ago

I will add tests.

davidwmartines commented 1 year ago

@xSAVIKx Thanks for the great feedback. I will get to work on this!

I agree on all points, except for requiring the key. Kafka does allow for null message keys, so I think we can allow a key of None. Let me know if you think this needs more discussion. I will try to clarify this when I add docs to the KafkaMessage class.

Good call on the key mapper function - I was wondering about that. I will add the option to supply a key-mapper as well.

davidwmartines commented 1 year ago

working on key_mapper next...

davidwmartines commented 1 year ago

@davidwmartines overall LGTM! thanks again for you work. Can you please address these 2 minor comments before we merge the PR?

Thanks!