Table of Contents

Interface PipeContext

Namespace
MassTransit
Assembly
MassTransit.Abstractions.dll

The base context for all pipe types, includes the payload side-banding of data with the payload, as well as the cancellationToken to avoid passing it everywhere

public interface PipeContext
Extension Methods

Properties

CancellationToken

Used to cancel the execution of the context

CancellationToken CancellationToken { get; }

Property Value

CancellationToken

Methods

AddOrUpdatePayload<T>(PayloadFactory<T>, UpdatePayloadFactory<T>)

Either adds a new payload, or updates an existing payload

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

GetOrAddPayload<T>(PayloadFactory<T>)

Returns an existing payload or creates the payload using the factory method provided

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

HasPayloadType(Type)

Checks if a payload is present in the context

bool HasPayloadType(Type payloadType)

Parameters

payloadType Type

Returns

bool

TryGetPayload<T>(out T?)

Retrieves a payload from the pipe context

bool TryGetPayload<T>(out T? payload) where T : class

Parameters

payload T

The payload

Returns

bool

Type Parameters

T

The payload type