Skip to content

Class InMemorySagaStateStore

Namespace: Cephalon.Behaviors.Patterns.Stores
Assembly: Cephalon.Behaviors.Patterns.dll

An in-memory implementation of backed by a with JSON serialization. Suitable for development and testing; replace with a durable store for production use.

public sealed class InMemorySagaStateStore : ISagaStateStore

objectInMemorySagaStateStore

ISagaStateStore

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Removes the saga state for the given saga identifier.

public Task DeleteAsync(string sagaId, CancellationToken ct = default)

sagaId string

The unique identifier of the saga instance to remove.

ct CancellationToken

A token that cancels the operation.

Task

A completed task.

Retrieves and deserializes the saga state for the given saga identifier.

public Task<T?> GetAsync<T>(string sagaId, CancellationToken ct = default)

sagaId string

The unique identifier of the saga instance.

ct CancellationToken

A token that cancels the operation.

Task<T?>

The deserialized state, or null if not found.

T

The saga state type.

SaveAsync<T>(string, T, CancellationToken)

Section titled “ SaveAsync<T>(string, T, CancellationToken)”

Serializes and upserts the saga state for the given saga identifier.

public Task SaveAsync<T>(string sagaId, T state, CancellationToken ct = default)

sagaId string

The unique identifier of the saga instance.

state T

The state to persist.

ct CancellationToken

A token that cancels the operation.

Task

A completed task.

T

The saga state type.