Class CloudEventDecodingReceiverExtensions
Applies inbound CloudEvents decoding to a transport receiver.
public static class CloudEventDecodingReceiverExtensions
- Inheritance
-
CloudEventDecodingReceiverExtensions
- Inherited Members
Methods
WithCloudEventDecoding(ITransportReceiver, CloudEventBinding)
Wraps a receiver so that inbound CloudEvents are decoded and published on each received message.
public static ITransportReceiver WithCloudEventDecoding(this ITransportReceiver receiver, CloudEventBinding binding)
Parameters
receiverITransportReceiverThe receiver to wrap.
bindingCloudEventBindingThe CloudEvents protocol binding this transport speaks, which decides how binary-mode attributes are named. Pass StructuredOnly where the specification assigns the transport no binding.
Returns
- ITransportReceiver
A receiver that decodes inbound CloudEvents before returning messages to the caller.
Remarks
Applied unconditionally, and that is safe because the decoder is total. A message carrying no CloudEvents markers is returned untouched — "not a CloudEvent" is a defined outcome rather than an error — so a consumer who never uses CloudEvents sees no behavioural change. Making the wrap conditional on a separate opt-in is what would leave the receive path asymmetric with send, where encoding is applied automatically once CloudEvents is configured.
The decoded event is attached to ProviderData; the message itself is not replaced, so callers that read the raw body are unaffected and acknowledgement still addresses the original message.