Class MissingConsumeContext
- Namespace
- MassTransit.Context
- Assembly
- MassTransit.Abstractions.dll
public class MissingConsumeContext : ConsumeContext, PipeContext, MessageContext, IPublishEndpoint, IPublishObserverConnector, ISendEndpointProvider, ISendObserverConnector
- Inheritance
-
MissingConsumeContext
- Implements
- 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>)
Constructors
MissingConsumeContext()
public MissingConsumeContext()
Properties
CancellationToken
Used to cancel the execution of the context
public CancellationToken CancellationToken { get; }
Property Value
ConsumeCompleted
An awaitable task that is completed once the consume context is completed
public Task ConsumeCompleted { get; }
Property Value
ConversationId
The conversationId of the message, which is copied and carried throughout the message flow by the infrastructure.
public Guid? ConversationId { get; }
Property Value
- Guid?
CorrelationId
If the message implements the CorrelatedBy(Guid) interface, this field should be populated by default to match that value. It can, of course, be overwritten with something else.
public Guid? CorrelationId { get; }
Property Value
- Guid?
DestinationAddress
The destination address of the message
public Uri DestinationAddress { get; }
Property Value
- Uri
ExpirationTime
The expiration time of the message if it is not intended to last forever.
public DateTime? ExpirationTime { get; }
Property Value
FaultAddress
The fault address to which fault events should be sent if the message consumer faults
public Uri FaultAddress { get; }
Property Value
- Uri
Headers
Additional application-specific headers that are added to the message by the application or by features within MassTransit, such as when a message is moved to an error queue.
public Headers Headers { get; }
Property Value
Host
The host information of the message producer. This may not be present if the message was sent from an earlier version of MassTransit.
public HostInfo Host { get; }
Property Value
InitiatorId
If this message was produced within the context of a previous message, the CorrelationId of the message is contained in this property. If the message was produced from a saga instance, the CorrelationId of the saga is used.
public Guid? InitiatorId { get; }
Property Value
- Guid?
Instance
public static ConsumeContext Instance { get; }
Property Value
MessageId
The messageId assigned to the message when it was initially Sent. This is different than the transport MessageId, which is only for the Transport.
public Guid? MessageId { get; }
Property Value
- Guid?
ReceiveContext
The received message context
public ReceiveContext ReceiveContext { get; }
Property Value
RequestId
If the message is a request, or related to a request, such as a response or a fault, this contains the requestId.
public Guid? RequestId { get; }
Property Value
- Guid?
ResponseAddress
The response address to which responses to the request should be sent
public Uri ResponseAddress { get; }
Property Value
- Uri
SentTime
When the message was originally sent
public DateTime? SentTime { get; }
Property Value
SerializerContext
The serializer context from message deserialization
public SerializerContext SerializerContext { get; }
Property Value
SourceAddress
The address of the message producer that sent the message
public Uri SourceAddress { get; }
Property Value
- Uri
SupportedMessageTypes
Returns the supported message types from the message
public IEnumerable<string> SupportedMessageTypes { get; }
Property Value
Methods
AddConsumeTask(Task)
Add a task that must complete before the consume is completed
public void AddConsumeTask(Task task)
Parameters
taskTask
AddOrUpdatePayload<T>(PayloadFactory<T>, UpdatePayloadFactory<T>)
Either adds a new payload, or updates an existing payload
public T AddOrUpdatePayload<T>(PayloadFactory<T> addFactory, UpdatePayloadFactory<T> updateFactory) where T : class
Parameters
addFactoryPayloadFactory<T>The payload factory called if the payload is not present
updateFactoryUpdatePayloadFactory<T>The payload factory called if the payload already exists
Returns
- T
Type Parameters
TThe payload type
ConnectPublishObserver(IPublishObserver)
public ConnectHandle ConnectPublishObserver(IPublishObserver observer)
Parameters
observerIPublishObserver
Returns
ConnectSendObserver(ISendObserver)
public ConnectHandle ConnectSendObserver(ISendObserver observer)
Parameters
observerISendObserver
Returns
GetOrAddPayload<T>(PayloadFactory<T>)
Returns an existing payload or creates the payload using the factory method provided
public T GetOrAddPayload<T>(PayloadFactory<T> payloadFactory) where T : class
Parameters
payloadFactoryPayloadFactory<T>The payload factory is the payload is not present
Returns
- T
The payload
Type Parameters
TThe payload type
GetSendEndpoint(Uri)
Return the send endpoint for the specified address
public Task<ISendEndpoint> GetSendEndpoint(Uri address)
Parameters
addressUriThe endpoint address
Returns
- Task<ISendEndpoint>
The send endpoint
HasMessageType(Type)
Returns true if the specified message type is contained in the serialized message
public bool HasMessageType(Type messageType)
Parameters
messageTypeType
Returns
HasPayloadType(Type)
Checks if a payload is present in the context
public bool HasPayloadType(Type payloadType)
Parameters
payloadTypeType
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.
public 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
public 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
Publish(object, IPipe<PublishContext>, CancellationToken)
Publishes an object as a message, using the message type specified. If the object cannot be cast to the specified message type, an exception will be thrown.
public Task Publish(object message, IPipe<PublishContext> publishPipe, CancellationToken cancellationToken)
Parameters
messageobjectThe message object
publishPipeIPipe<PublishContext>cancellationTokenCancellationToken
Returns
Publish(object, CancellationToken)
Publishes an object as a message, using the message type specified. If the object cannot be cast to the specified message type, an exception will be thrown.
public Task Publish(object message, CancellationToken cancellationToken)
Parameters
messageobjectThe message object
cancellationTokenCancellationToken
Returns
Publish(object, Type, IPipe<PublishContext>, CancellationToken)
Publishes an object as a message, using the message type specified. If the object cannot be cast to the specified message type, an exception will be thrown.
public Task Publish(object message, Type messageType, IPipe<PublishContext> publishPipe, CancellationToken cancellationToken)
Parameters
messageobjectThe message object
messageTypeTypeThe type of the message (use message.GetType() if desired)
publishPipeIPipe<PublishContext>cancellationTokenCancellationToken
Returns
Publish(object, Type, CancellationToken)
Publishes an object as a message, using the message type specified. If the object cannot be cast to the specified message type, an exception will be thrown.
public Task Publish(object message, Type messageType, CancellationToken cancellationToken)
Parameters
messageobjectThe message object
messageTypeTypeThe type of the message (use message.GetType() if desired)
cancellationTokenCancellationToken
Returns
Publish<T>(object, IPipe<PublishContext<T>>, CancellationToken)
Publish<T>(T, CancellationToken): this overload further takes an action; it allows you to set PublishContext meta-data. Also Publish<T>(T, CancellationToken).
public Task Publish<T>(object values, IPipe<PublishContext<T>> publishPipe, CancellationToken cancellationToken) where T : class
Parameters
valuesobjectThe dictionary of values to become hydrated and published under the type of the interface.
publishPipeIPipe<PublishContext<T>>cancellationTokenCancellationToken
Returns
Type Parameters
TThe type of the message to publish
Publish<T>(object, IPipe<PublishContext>, CancellationToken)
Publish<T>(T, CancellationToken): this overload further takes an action; it allows you to set PublishContext meta-data. Also Publish<T>(T, CancellationToken).
public Task Publish<T>(object values, IPipe<PublishContext> publishPipe, CancellationToken cancellationToken) where T : class
Parameters
valuesobjectThe dictionary of values to become hydrated and published under the type of the interface.
publishPipeIPipe<PublishContext>cancellationTokenCancellationToken
Returns
Type Parameters
TThe type of the message to publish
Publish<T>(object, CancellationToken)
Publish<T>(T, CancellationToken): this is a "dynamically" typed overload - give it an interface as its type parameter, and a loosely typed dictionary of values and the MassTransit underlying infrastructure will populate an object instance with the passed values. It actually does this with DynamicProxy in the background.
public Task Publish<T>(object values, CancellationToken cancellationToken) where T : class
Parameters
valuesobjectThe dictionary of values to place in the object instance to implement the interface.
cancellationTokenCancellationToken
Returns
Type Parameters
TThe type of the interface or non-sealed class with all-virtual members.
Publish<T>(T, IPipe<PublishContext<T>>, CancellationToken)
Publishes a message to all subscribed consumers for the message type as specified by the generic parameter. The second parameter allows the caller to customize the outgoing publish context and set things like headers on the message.
Read up on publishing: http://readthedocs.org/docs/masstransit/en/latest/overview/publishing.html
public Task Publish<T>(T message, IPipe<PublishContext<T>> publishPipe, CancellationToken cancellationToken) where T : class
Parameters
messageTThe messages to be published
publishPipeIPipe<PublishContext<T>>cancellationTokenCancellationToken
Returns
Type Parameters
TThe type of the message
Publish<T>(T, IPipe<PublishContext>, CancellationToken)
Publishes a message to all subscribed consumers for the message type as specified by the generic parameter. The second parameter allows the caller to customize the outgoing publish context and set things like headers on the message.
Read up on publishing: http://readthedocs.org/docs/masstransit/en/latest/overview/publishing.html
public Task Publish<T>(T message, IPipe<PublishContext> publishPipe, CancellationToken cancellationToken) where T : class
Parameters
messageTThe messages to be published
publishPipeIPipe<PublishContext>cancellationTokenCancellationToken
Returns
Type Parameters
TThe type of the message
Publish<T>(T, CancellationToken)
Publishes a message to all subscribed consumers for the message type as specified by the generic parameter. The second parameter allows the caller to customize the outgoing publish context and set things like headers on the message.
Read up on publishing: http://readthedocs.org/docs/masstransit/en/latest/overview/publishing.html
public Task Publish<T>(T message, CancellationToken cancellationToken) where T : class
Parameters
messageTThe messages to be published
cancellationTokenCancellationToken
Returns
Type Parameters
TThe type of the message
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)
public 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)
public 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)
public 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)
public 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)
public 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)
public 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)
public 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)
public 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)
public 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)
public 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.
public 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
public bool TryGetMessage<T>(out ConsumeContext<T> consumeContext) where T : class
Parameters
consumeContextConsumeContext<T>
Returns
Type Parameters
T
TryGetPayload<T>(out T?)
Retrieves a payload from the pipe context
public bool TryGetPayload<T>(out T? payload) where T : class
Parameters
payloadTThe payload
Returns
Type Parameters
TThe payload type