Interface ConsumeContext
- Namespace
- MassTransit
- Assembly
- MassTransit.Abstractions.dll
public interface ConsumeContext : PipeContext, MessageContext, IPublishEndpoint, IPublishObserverConnector, ISendEndpointProvider, ISendObserverConnector
- Inherited Members
- Extension Methods
-
SchedulePublishExtensions.SchedulePublish(ConsumeContext, DateTime, object, Type, CancellationToken)SchedulePublishExtensions.SchedulePublish(ConsumeContext, TimeSpan, object, Type, CancellationToken)SendConsumeContextExecuteExtensions.Send(ConsumeContext, Uri, object, Type, Func<SendContext, Task>)
Properties
ConsumeCompleted
An awaitable task that is completed once the consume context is completed
Task ConsumeCompleted { get; }
Property Value
ReceiveContext
The received message context
ReceiveContext ReceiveContext { get; }
Property Value
SerializerContext
The serializer context from message deserialization
SerializerContext SerializerContext { get; }
Property Value
SupportedMessageTypes
Returns the supported message types from the message
IEnumerable<string> SupportedMessageTypes { get; }
Property Value
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
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
TimeSpanconsumerType
stringThe consumer type
Returns
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
TimeSpanconsumerType
stringThe message consumer type
exception
ExceptionThe exception that occurred
Returns
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
objectThe message to send
Returns
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
objectThe message to send
sendPipe
IPipe<SendContext>
Returns
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
Returns
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
objectThe message to send
messageType
TypeThe message type to send
sendPipe
IPipe<SendContext>
Returns
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
objectThe values for the message properties
Returns
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
objectThe values for the message properties
sendPipe
IPipe<SendContext<T>>
Returns
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
objectThe values for the message properties
sendPipe
IPipe<SendContext>
Returns
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
TThe message to send in response
Returns
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
TThe message to send in response
sendPipe
IPipe<SendContext<T>>The pipe used to customize the response send context
Returns
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
TThe message to send in response
sendPipe
IPipe<SendContext>The pipe used to customize the response send context
Returns
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
TThe 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
Type Parameters
T