Use the Message interface to abstract protocol data
mainThe Message interface is a binding-specific abstraction that allows you to read a CloudEvent from a protocol-specific data structure.
Key Operations
- Conversion:
- Wrap an
Eventinto aMessageusingbinding.ToMessage(). - Convert a
Messageto anEventusingbinding.ToEvent().
- Wrap an
- Lifecycle Management:
- Buffering: Some
Messageimplementations can only be read once because the encoding process drains the message. Use thebufferingmodule to buffer aMessageif you need to consume it multiple times. - Cleanup: You must invoke
Message.Finish()whenever theMessagereceiver or emitter is finished with the message to prevent resource leaks.
- Buffering: Some