Table of Contents

Interface IEventCorrelationConfigurator<TSaga, TMessage>

Namespace
MassTransit
Assembly
MassTransit.Abstractions.dll
public interface IEventCorrelationConfigurator<TSaga, TMessage> where TSaga : class, SagaStateMachineInstance where TMessage : class

Type Parameters

TSaga
TMessage

Properties

ConfigureConsumeTopology

If set to false, the event type will not be configured as part of the broker topology

bool ConfigureConsumeTopology { set; }

Property Value

bool

InsertOnInitial

If set to true, the state machine suggests that the saga instance be inserted blinding prior to the get/lock using a weaker isolation level. This prevents range locks in the database from slowing inserts.

bool InsertOnInitial { set; }

Property Value

bool

ReadOnly

If set to true, changes to the saga instance will not be saved to the repository. Note that the in-memory saga repository does not support read-only since the changes are made directly to the saga instance.

bool ReadOnly { set; }

Property Value

bool

Methods

CorrelateBy(Expression<Func<TSaga, ConsumeContext<TMessage>, bool>>)

Specify the correlation expression for the event

IEventCorrelationConfigurator<TSaga, TMessage> CorrelateBy(Expression<Func<TSaga, ConsumeContext<TMessage>, bool>> correlationExpression)

Parameters

correlationExpression Expression<Func<TSaga, ConsumeContext<TMessage>, bool>>

Returns

IEventCorrelationConfigurator<TSaga, TMessage>

CorrelateById(Func<ConsumeContext<TMessage>, Guid>)

Correlate to the saga instance by CorrelationId, using the id from the event data

IEventCorrelationConfigurator<TSaga, TMessage> CorrelateById(Func<ConsumeContext<TMessage>, Guid> selector)

Parameters

selector Func<ConsumeContext<TMessage>, Guid>

Returns the CorrelationId from the event data

Returns

IEventCorrelationConfigurator<TSaga, TMessage>

CorrelateById<T>(Expression<Func<TSaga, T>>, Func<ConsumeContext<TMessage>, T>)

Correlate to the saga instance by a single value property, matched to the property value of the message

IEventCorrelationConfigurator<TSaga, TMessage> CorrelateById<T>(Expression<Func<TSaga, T>> propertyExpression, Func<ConsumeContext<TMessage>, T> selector) where T : struct

Parameters

propertyExpression Expression<Func<TSaga, T>>

The instance property

selector Func<ConsumeContext<TMessage>, T>

The identifier selector for the message

Returns

IEventCorrelationConfigurator<TSaga, TMessage>

Type Parameters

T

CorrelateBy<T>(Expression<Func<TSaga, T?>>, Func<ConsumeContext<TMessage>, T?>)

Correlate to the saga instance by a single property, matched to the property value of the message

IEventCorrelationConfigurator<TSaga, TMessage> CorrelateBy<T>(Expression<Func<TSaga, T?>> propertyExpression, Func<ConsumeContext<TMessage>, T?> selector) where T : struct

Parameters

propertyExpression Expression<Func<TSaga, T?>>

The instance property

selector Func<ConsumeContext<TMessage>, T?>

Returns

IEventCorrelationConfigurator<TSaga, TMessage>

Type Parameters

T

CorrelateBy<T>(Expression<Func<TSaga, T>>, Func<ConsumeContext<TMessage>, T>)

Correlate to the saga instance by a single property, matched to the property value of the message

IEventCorrelationConfigurator<TSaga, TMessage> CorrelateBy<T>(Expression<Func<TSaga, T>> propertyExpression, Func<ConsumeContext<TMessage>, T> selector) where T : class

Parameters

propertyExpression Expression<Func<TSaga, T>>

The instance property

selector Func<ConsumeContext<TMessage>, T>

Returns

IEventCorrelationConfigurator<TSaga, TMessage>

Type Parameters

T

OnMissingInstance(Func<IMissingInstanceConfigurator<TSaga, TMessage>, IPipe<ConsumeContext<TMessage>>>)

If an event is consumed that is not matched to an existing saga instance, discard the event without throwing an exception. The default behavior is to throw an exception, which moves the event into the error queue for later processing

IEventCorrelationConfigurator<TSaga, TMessage> OnMissingInstance(Func<IMissingInstanceConfigurator<TSaga, TMessage>, IPipe<ConsumeContext<TMessage>>> getBehavior)

Parameters

getBehavior Func<IMissingInstanceConfigurator<TSaga, TMessage>, IPipe<ConsumeContext<TMessage>>>

The configuration call to specify the behavior on missing instance

Returns

IEventCorrelationConfigurator<TSaga, TMessage>

SelectId(Func<ConsumeContext<TMessage>, Guid>)

When creating a new saga instance, initialize the saga CorrelationId with the id from the event data

IEventCorrelationConfigurator<TSaga, TMessage> SelectId(Func<ConsumeContext<TMessage>, Guid> selector)

Parameters

selector Func<ConsumeContext<TMessage>, Guid>

Returns the CorrelationId from the event data

Returns

IEventCorrelationConfigurator<TSaga, TMessage>

SetSagaFactory(SagaFactoryMethod<TSaga, TMessage>)

Creates a new instance of the saga, and if appropriate, pre-inserts the saga instance to the database. If the saga already exists, any exceptions from the insert are suppressed and processing continues normally.

IEventCorrelationConfigurator<TSaga, TMessage> SetSagaFactory(SagaFactoryMethod<TSaga, TMessage> factoryMethod)

Parameters

factoryMethod SagaFactoryMethod<TSaga, TMessage>

The factory method for the saga

Returns

IEventCorrelationConfigurator<TSaga, TMessage>