Class Occurrences

Namespace
Cratis.Chronicle.Occurrences
Assembly
Cratis.Chronicle.dll

Provides durable receipts in the event store's namespace.

public class Occurrences : IOccurrences, IDisposable, IAsyncDisposable
Inheritance
Occurrences
Implements
Inherited Members
Extension Methods

Constructors

Occurrences(IEventStore)

Provides durable receipts in the event store's namespace.

public Occurrences(IEventStore eventStore)

Parameters

eventStore IEventStore

The namespace-bound event store.

Methods

Dispose()

public void Dispose()

DisposeAsync()

public ValueTask DisposeAsync()

Returns

ValueTask

EndActivation(ActivationId)

Explicitly ends a logical activation, recording Shutdown once. Stopping one instance never calls this implicitly.

public Task EndActivation(ActivationId activationId)

Parameters

activationId ActivationId

The activation to end, shared across all instances.

Returns

Task

The durable recording work.

Exceptions

OccurrencesNotSupported

Occurrence support is absent or unknown.

GetEffectReceipt(EffectKey)

Looks up the first durable outcome without executing the effect again.

public Task<EffectReceipt?> GetEffectReceipt(EffectKey key)

Parameters

key EffectKey

The effect key.

Returns

Task<EffectReceipt>

The stored receipt, or null if none exists.

Exceptions

EffectReceiptsNotSupported

Receipt support is absent or unknown.

Record(object, string)

Records an application trigger in this namespace. This is an in-process API, not a public trigger endpoint.

public Task<OccurrenceRecordResult> Record(object trigger, string idempotencyId)

Parameters

trigger object

The discovered typed plaintext payload, without personal data.

idempotencyId string

A stable identity for this ingress, reused on retries.

Returns

Task<OccurrenceRecordResult>

The durable ingress outcome, including identity conflicts and invalid payloads.

Exceptions

OccurrencesNotSupported

Occurrence support is absent or unknown.

TriggerNotValid

The trigger has not been discovered.

RecordEffectReceipt(EffectKey, EffectOutcome, JsonNode?)

Records a terminal refusal or a successful effect without events or protected reads.

public Task<EffectReceiptResult> RecordEffectReceipt(EffectKey key, EffectOutcome outcome, JsonNode? response = null)

Parameters

key EffectKey

The effect key.

outcome EffectOutcome

NoEvents or Refused. Appended is only written through a unit of work.

response JsonNode

Optional plaintext JSON response, without personal data.

Returns

Task<EffectReceiptResult>

The first durable receipt, including its winning response.

Exceptions

EffectReceiptsNotSupported

Receipt support is absent or unknown.

EffectReceiptResponseTooLarge

The response exceeds 64 KiB of UTF-8 JSON.

EffectReceiptNotValid

The key or outcome is invalid.