sdk-go
sdk-go copied to clipboard
Propose adding receiver transformer for message queue protocols
Some of the event metadata might differ between sender and receiver. Like the Kafka protocol, we expect to add the topic/partition/offset
information after receiving the event.
- Sender
Context Attributes,
specversion: 1.0
...
datacontenttype: application/json
Data,
{
"id": 0,
"message": "Hello, World!"
}
- Reciever
Context Attributes,
specversion: 1.0
...
datacontenttype: application/json
Extensions,
kafkaoffset: 543
kafkapartition: 0
kafkatopic: test-confluent-topic
Data,
{
"id": 0,
"message": "Hello, World!"
}
It works fine when transferring the event with binary mode. But the event metadata become the same between sender and receiver in the structured mode. So I propose adding receiver transformers to modify the event metadata for the receiver.
However, I am concerned about whether this will undermine the original design intent of the structured mode. Therefore, I opened the issue here for discussing. At the same time, to express my ideas more clearly, I also drafted a PR to demonstrate possible code changes: https://github.com/cloudevents/sdk-go/pull/1053