CloudEvents
Last updated
Was this helpful?
Last updated
Was this helpful?
is a vendor-neutral specification for defining the format of event data. You can find the spec here:
CloudEvents Governace:
CloudEvents can be transported in two ways:
Structured mode: The CloudEvents data is encoded (typically as JSON) in the message value, with content-type set appropriately.
Binary mode: The CloudEvent attributes are mapped to message headers, while the data is carried in the message value.
Binary mode works well in a multi-protocol environment with Kafka, RabbitMQ, and EventBridge! The CloudEvents specification is deliberately protocol-agnostic and provides protocol bindings for each of these systems.
Here's how binary mode maps across these systems:
Kafka
CloudEvent attributes become message headers with "ce_" prefix
Data goes into message value
RabbitMQ
CloudEvent attributes become AMQP message application properties with "ce_" prefix
Data goes into message body
AWS EventBridge
CloudEvent attributes map to EventBridge message attributes
There's an official AWS Event Format that's compatible with CloudEvents
Key Benefits of Using Binary Mode Across These Systems:
Consistent header-based metadata access
Easier routing/filtering based on CloudEvent attributes
No need to parse the payload to access metadata
Better performance compared to structured mode
However, be aware of these considerations:
Each system has different header size limits
Header value encoding might need to be handled differently
You'll need to implement protocol-specific serialization/deserialization