Table of Contents

Interface ConsumeContext

Namespace
MassTransit
Assembly
MassTransit.Abstractions.dll
public interface ConsumeContext : PipeContext, MessageContext, IPublishEndpoint, IPublishObserverConnector, ISendEndpointProvider, ISendObserverConnector
Inherited Members
Extension Methods

Properties

ConsumeCompleted

An awaitable task that is completed once the consume context is completed

Task ConsumeCompleted { get; }

Property Value

Task

ReceiveContext

The received message context

ReceiveContext ReceiveContext { get; }

Property Value

ReceiveContext

SerializerContext

The serializer context from message deserialization

SerializerContext SerializerContext { get; }

Property Value

SerializerContext

SupportedMessageTypes

Returns the supported message types from the message

IEnumerable<string> SupportedMessageTypes { get; }

Property Value

IEnumerable<string>

Methods

AddConsumeTask(Task)

Add a task that must complete before the consume is completed

void AddConsumeTask(Task task)

Parameters

task Task

HasMessageType(Type)

Returns true if the specified message type is contained in the serialized message

bool HasMessageType(Type messageType)

Parameters

messageType Type

Returns

bool

NotifyConsumed<T>(ConsumeContext<T>, TimeSpan, string)

Notify that the message has been consumed -- note that this is internal, and should not be called by a consumer.

Task NotifyConsumed<T>(ConsumeContext<T> context, TimeSpan duration, string consumerType) where T : class

Parameters

context ConsumeContext<T>
duration TimeSpan
consumerType string

The consumer type

Returns

Task

Type Parameters

T

NotifyFaulted<T>(ConsumeContext<T>, TimeSpan, string, Exception)

Notify that a message consumer has faulted -- note that this is internal, and should not be called by a consumer

Task NotifyFaulted<T>(ConsumeContext<T> context, TimeSpan duration, string consumerType, Exception exception) where T : class

Parameters

context ConsumeContext<T>
duration TimeSpan
consumerType string

The message consumer type

exception Exception

The exception that occurred

Returns

Task

Type Parameters

T

RespondAsync(object)

Responds to the current message immediately, returning the Task for the sending message. The caller may choose to await the response to ensure it was sent, or allow the framework to wait for it (which will happen automatically before the message is acknowledged)

Task RespondAsync(object message)

Parameters

message object

The message to send

Returns

Task

RespondAsync(object, IPipe<SendContext>)

Responds to the current message immediately, returning the Task for the sending message. The caller may choose to await the response to ensure it was sent, or allow the framework to wait for it (which will happen automatically before the message is acknowledged)

Task RespondAsync(object message, IPipe<SendContext> sendPipe)

Parameters

message object

The message to send

sendPipe IPipe<SendContext>

Returns

Task

RespondAsync(object, Type)

Responds to the current message immediately, returning the Task for the sending message. The caller may choose to await the response to ensure it was sent, or allow the framework to wait for it (which will happen automatically before the message is acknowledged)

Task RespondAsync(object message, Type messageType)

Parameters

message object

The message to send

messageType Type

The message type to send

Returns

Task

RespondAsync(object, Type, IPipe<SendContext>)

Responds to the current message immediately, returning the Task for the sending message. The caller may choose to await the response to ensure it was sent, or allow the framework to wait for it (which will happen automatically before the message is acknowledged)

Task RespondAsync(object message, Type messageType, IPipe<SendContext> sendPipe)

Parameters

message object

The message to send

messageType Type

The message type to send

sendPipe IPipe<SendContext>

Returns

Task

RespondAsync<T>(object)

Responds to the current message immediately, returning the Task for the sending message. The caller may choose to await the response to ensure it was sent, or allow the framework to wait for it (which will happen automatically before the message is acknowledged)

Task RespondAsync<T>(object values) where T : class

Parameters

values object

The values for the message properties

Returns

Task

Type Parameters

T

The type of the message to respond with.

RespondAsync<T>(object, IPipe<SendContext<T>>)

Responds to the current message immediately, returning the Task for the sending message. The caller may choose to await the response to ensure it was sent, or allow the framework to wait for it (which will happen automatically before the message is acknowledged)

Task RespondAsync<T>(object values, IPipe<SendContext<T>> sendPipe) where T : class

Parameters

values object

The values for the message properties

sendPipe IPipe<SendContext<T>>

Returns

Task

Type Parameters

T

The type of the message to respond with.

RespondAsync<T>(object, IPipe<SendContext>)

Responds to the current message immediately, returning the Task for the sending message. The caller may choose to await the response to ensure it was sent, or allow the framework to wait for it (which will happen automatically before the message is acknowledged)

Task RespondAsync<T>(object values, IPipe<SendContext> sendPipe) where T : class

Parameters

values object

The values for the message properties

sendPipe IPipe<SendContext>

Returns

Task

Type Parameters

T

The type of the message to respond with.

RespondAsync<T>(T)

Responds to the current message immediately, returning the Task for the sending message. The caller may choose to await the response to ensure it was sent, or allow the framework to wait for it (which will happen automatically before the message is acknowledged)

Task RespondAsync<T>(T message) where T : class

Parameters

message T

The message to send in response

Returns

Task

Type Parameters

T

The type of the message to respond with.

RespondAsync<T>(T, IPipe<SendContext<T>>)

Responds to the current message immediately, returning the Task for the sending message. The caller may choose to await the response to ensure it was sent, or allow the framework to wait for it (which will happen automatically before the message is acknowledged)

Task RespondAsync<T>(T message, IPipe<SendContext<T>> sendPipe) where T : class

Parameters

message T

The message to send in response

sendPipe IPipe<SendContext<T>>

The pipe used to customize the response send context

Returns

Task

Type Parameters

T

The type of the message to respond with.

RespondAsync<T>(T, IPipe<SendContext>)

Responds to the current message immediately, returning the Task for the sending message. The caller may choose to await the response to ensure it was sent, or allow the framework to wait for it (which will happen automatically before the message is acknowledged)

Task RespondAsync<T>(T message, IPipe<SendContext> sendPipe) where T : class

Parameters

message T

The message to send in response

sendPipe IPipe<SendContext>

The pipe used to customize the response send context

Returns

Task

Type Parameters

T

The type of the message to respond with.

Respond<T>(T)

Adds a response to the message being consumed, which will be sent once the consumer has completed. The message is not acknowledged until the response is acknowledged.

void Respond<T>(T message) where T : class

Parameters

message T

The message to send in response

Type Parameters

T

The type of the message to respond with.

TryGetMessage<T>(out ConsumeContext<T>?)

Returns the specified message type if available, otherwise returns false

bool TryGetMessage<T>(out ConsumeContext<T>? consumeContext) where T : class

Parameters

consumeContext ConsumeContext<T>

Returns

bool

Type Parameters

T