Table of Contents

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

Constructors

MissingConsumeContext()

public MissingConsumeContext()

Properties

CancellationToken

Used to cancel the execution of the context

public CancellationToken CancellationToken { get; }

Property Value

CancellationToken

ConsumeCompleted

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

public Task ConsumeCompleted { get; }

Property Value

Task

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

DateTime?

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

Headers

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

HostInfo

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

ConsumeContext

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

ReceiveContext

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

DateTime?

SerializerContext

The serializer context from message deserialization

public SerializerContext SerializerContext { get; }

Property Value

SerializerContext

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

IEnumerable<string>

Methods

AddConsumeTask(Task)

Add a task that must complete before the consume is completed

public void AddConsumeTask(Task task)

Parameters

task Task

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

addFactory PayloadFactory<T>

The payload factory called if the payload is not present

updateFactory UpdatePayloadFactory<T>

The payload factory called if the payload already exists

Returns

T

Type Parameters

T

The payload type

ConnectPublishObserver(IPublishObserver)

public ConnectHandle ConnectPublishObserver(IPublishObserver observer)

Parameters

observer IPublishObserver

Returns

ConnectHandle

ConnectSendObserver(ISendObserver)

public ConnectHandle ConnectSendObserver(ISendObserver observer)

Parameters

observer ISendObserver

Returns

ConnectHandle

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

payloadFactory PayloadFactory<T>

The payload factory is the payload is not present

Returns

T

The payload

Type Parameters

T

The payload type

GetSendEndpoint(Uri)

Return the send endpoint for the specified address

public Task<ISendEndpoint> GetSendEndpoint(Uri address)

Parameters

address Uri

The 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

messageType Type

Returns

bool

HasPayloadType(Type)

Checks if a payload is present in the context

public bool HasPayloadType(Type payloadType)

Parameters

payloadType 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.

public 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

public 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

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

message object

The message object

publishPipe IPipe<PublishContext>
cancellationToken CancellationToken

Returns

Task

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

message object

The message object

cancellationToken CancellationToken

Returns

Task

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

message object

The message object

messageType Type

The type of the message (use message.GetType() if desired)

publishPipe IPipe<PublishContext>
cancellationToken CancellationToken

Returns

Task

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

message object

The message object

messageType Type

The type of the message (use message.GetType() if desired)

cancellationToken CancellationToken

Returns

Task

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

values object

The dictionary of values to become hydrated and published under the type of the interface.

publishPipe IPipe<PublishContext<T>>
cancellationToken CancellationToken

Returns

Task

Type Parameters

T

The 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

values object

The dictionary of values to become hydrated and published under the type of the interface.

publishPipe IPipe<PublishContext>
cancellationToken CancellationToken

Returns

Task

Type Parameters

T

The 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

values object

The dictionary of values to place in the object instance to implement the interface.

cancellationToken CancellationToken

Returns

Task

Type Parameters

T

The 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

message T

The messages to be published

publishPipe IPipe<PublishContext<T>>
cancellationToken CancellationToken

Returns

Task

Type Parameters

T

The 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

message T

The messages to be published

publishPipe IPipe<PublishContext>
cancellationToken CancellationToken

Returns

Task

Type Parameters

T

The 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

message T

The messages to be published

cancellationToken CancellationToken

Returns

Task

Type Parameters

T

The 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

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)

public 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)

public 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)

public 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)

public 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)

public 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)

public 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)

public 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)

public 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)

public 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.

public 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

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

Parameters

consumeContext ConsumeContext<T>

Returns

bool

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

payload T

The payload

Returns

bool

Type Parameters

T

The payload type