Closed christianplatta1012 closed 3 months ago
Hey @christianplatta1012. Thx for opening the issue.
I believe you're referring to binary part of the spec while using to_structured
(i.e. structured) conversion.
We do have a test case that covers the binary headers:
If you believe that there still is an issue can you please provide an example of using respective conversion mode that is behaving wrongly or is not covered.
That was what I was looking for, thank you!
Expected Behavior
According to the 1.0 specification all CloudEvent attributes should be included as header values in a Kafka message with a ce_ prefix. https://github.com/cloudevents/spec/blob/v1.0/kafka-protocol-binding.md#3231-property-names I would expect that the to_structured function. in cloudevents.kafka.conversion should be doing this.
Actual Behavior
Instead all attributes are added to the message value json and the headers are empty. If I look into the source code attributes are never getting mapped into headers at all (with or without prefix)
Steps to Reproduce the Problem
from cloudevents.http import CloudEvent from cloudevents.kafka.conversion import to_structured
def test_kafka_cloud_event(): attributes = { "specversion": "1.0", "type": "topic", "source": "source", "contenttype": "application/json", } event = CloudEvent(attributes, {"key": "value"}) kafka_message = to_structured(event) print(kafka_message) print(kafka_message.headers) print(kafka_message.key) print(kafka_message.value) assert "ce_specversion" in kafka_message.headers
Specifications