แก้ไข

แชร์ผ่าน


MessageContext Class

Definition

Represents the context for storing different Features required for the processing of message(s).

public ref class MessageContext sealed
public sealed class MessageContext
type MessageContext = class
Public NotInheritable Class MessageContext
Inheritance
MessageContext

Remarks

Inspired from ASP.NET Core HttpContext.

Constructors

MessageContext(IFeatureCollection)

Initializes a new instance of the MessageContext class.

Properties

DestinationFeatures

Gets the feature collection to register implementation for different types for sending message to IMessageDestination.

DestinationPayload

Gets the message payload to be sent to IMessageDestination.

Features

Gets the feature collection to register implementation for different types which will be helpful to process the message.

MessageCancelledToken

Gets or sets the cancellation token for the cancelling the message processing.

SourceFeatures

Gets the feature collection to register implementation for different types for the message obtained from the IMessageSource.

SourcePayload

Gets the message payload obtained from the IMessageSource.

Methods

AddDestinationFeature<T>(T)

Sets the feature for the IMessageDestination in the DestinationFeatures.

AddFeature<T>(T)

Sets the feature of the IMessageSource in the Features.

AddSourceFeature<T>(T)

Sets the feature of the IMessageSource in the SourceFeatures.

GetUTF8SourcePayloadAsString()

Gets the SourcePayload as UTF8 encoded String.

MarkCompleteAsync(CancellationToken)

Marks the message processing to be completed asynchronously.

SetDestinationPayload(ReadOnlyMemory<Byte>)

Sets the payload in the MessageContext for the IMessageDestination message.

TryGetUTF8DestinationPayloadAsString(String)

Try to get the DestinationPayload message registered with MessageContext as a String in the UTF8 encoding.

Extension Methods

SetMessageCancelledTokenSource(MessageContext, CancellationTokenSource)

Sets the CancellationTokenSource and the corresponding CancellationToken in the MessageCancelledToken.

TryGetMessageCancelledTokenSource(MessageContext, CancellationTokenSource)

Try to get the CancellationTokenSource for the MessageCancelledToken.

MarkCompleteAsync(MessageContext, CancellationToken)

Marks the message processing as complete.

SetMessageCompleteActionFeature(MessageContext, IMessageCompleteActionFeature)

Sets the IMessageCompleteActionFeature to the MessageContext.

SetMessageDestinationFeatures(MessageContext, IFeatureCollection)

Sets the destinationFeatures in context.

TryGetMessageDestinationFeatures(MessageContext, IFeatureCollection)

Try get the destinationFeatures from the context.

GetDestinationPayload(MessageContext)

Gets the message payload for IMessageDestination.

SetDestinationPayload(MessageContext, Byte[])

Sets the message payload in the MessageContext for IMessageDestination.

SetDestinationPayload(MessageContext, ReadOnlyMemory<Byte>)

Sets the message payload in the MessageContext for IMessageDestination.

TryGetDestinationPayload(MessageContext, Nullable<ReadOnlyMemory<Byte>>)

Try to get the message payload for IMessageDestination as ReadOnlyMemory<T> of Byte.

TryGetDestinationPayloadAsUTF8String(MessageContext, String)

Gets the message payload for IMessageDestination as String in UTF8.

SetLatencyContext(MessageContext, ILatencyContext)

Sets the Microsoft.Extensions.Telemetry.Latency.ILatencyContext in MessageContext.

TryGetLatencyContext(MessageContext, ILatencyContext)

Try to get the Microsoft.Extensions.Telemetry.Latency.ILatencyContext from the MessageContext.

PostponeAsync(MessageContext, TimeSpan, CancellationToken)

Postpones the message processing asynchronously.

SetMessagePostponeActionFeature(MessageContext, IMessagePostponeActionFeature)

Sets the IMessagePostponeActionFeature to the MessageContext.

PostponeAsync(MessageContext, TimeSpan, CancellationToken)

Postpones the message processing asynchronously.

SetMessagePostponeFeature(MessageContext, IMessagePostponeFeature)

Sets the IMessagePostponeFeature in the MessageContext.

SetMessageSourceFeatures(MessageContext, IFeatureCollection)

Sets the sourceFeatures in context.

TryGetMessageSourceFeatures(MessageContext, IFeatureCollection)

Try get the sourceFeatures from the context.

GetSourcePayload(MessageContext)

Gets the message payload obtained from IMessageSource.

SetSourcePayload(MessageContext, Byte[])

Sets the message payload in the MessageContext obtained from IMessageSource.

SetSourcePayload(MessageContext, ReadOnlyMemory<Byte>)

Sets the message payload in the MessageContext obtained from IMessageSource.

TryGetSourcePayload(MessageContext, Nullable<ReadOnlyMemory<Byte>>)

Try to get the message payload obtained from IMessageSource.

TryGetSourcePayloadAsUTF8String(MessageContext, String)

Gets the message payload obtained from IMessageSource as String.

SetVisibilityDelay(MessageContext, TimeSpan)

Sets IMessageVisibilityDelayFeature with the provided visibilityDelay in the MessageContext.

TryGetVisibilityDelay(MessageContext, IMessageVisibilityDelayFeature)

Tries to get IMessageVisibilityDelayFeature in the provided visibilityDelay from the MessageContext.

GetSerializedPayload<T>(MessageContext)

Gets the message payload as a serialized T type.

SetSerializedPayload<T>(MessageContext, T)

Sets the message payload in the MessageContext as a serialized T type.

TryGetSerializedPayload<T>(MessageContext, T)

Try to get the serialized message payload of T type from the MessageContext.

Applies to