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
taskTask
HasMessageType(Type)
Returns true if the specified message type is contained in the serialized message
bool HasMessageType(Type messageType)
Parameters
messageTypeType
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
contextConsumeContext<T>durationTimeSpanconsumerTypestringThe 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
contextConsumeContext<T>durationTimeSpanconsumerTypestringThe message consumer type
exceptionExceptionThe 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
messageobjectThe 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
messageobjectThe message to send
sendPipeIPipe<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
messageobjectThe message to send
messageTypeTypeThe message type to send
sendPipeIPipe<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
valuesobjectThe values for the message properties
Returns
Type Parameters
TThe 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
valuesobjectThe values for the message properties
sendPipeIPipe<SendContext<T>>
Returns
Type Parameters
TThe 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
valuesobjectThe values for the message properties
sendPipeIPipe<SendContext>
Returns
Type Parameters
TThe 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
messageTThe message to send in response
Returns
Type Parameters
TThe 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
messageTThe message to send in response
sendPipeIPipe<SendContext<T>>The pipe used to customize the response send context
Returns
Type Parameters
TThe 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
messageTThe message to send in response
sendPipeIPipe<SendContext>The pipe used to customize the response send context
Returns
Type Parameters
TThe 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
messageTThe message to send in response
Type Parameters
TThe 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
consumeContextConsumeContext<T>
Returns
Type Parameters
T