Table of Contents

Interface IOutboxPayloadTransformStore

Namespace
Excalibur.Dispatch
Assembly
Excalibur.Dispatch.Abstractions.dll

Optional provider-owned legacy enqueue with payload transformation before persistence.

public interface IOutboxPayloadTransformStore
Extension Methods

Remarks

Discover this facet through its owning IOutboxStore and GetService. It operates on that same store's rows and does not supply a separate store registration, tenant boundary, worker admission, claim or fencing capability. The provider retains its original serializer, envelope construction, framing, identity, routing and transaction behavior; only payload bytes change. Invariant decorators must not expose this writer without mediation that preserves their invariant.

Methods

EnqueueWithPayloadTransformAsync(IDispatchMessage, IMessageContext, Func<ReadOnlyMemory<byte>, string?, CancellationToken, ValueTask<byte[]>>, CancellationToken)

Prepares the provider's envelope, transforms its payload once, then persists it.

[RequiresUnreferencedCode("Outbox stores serialize the message payload reflectively; supply JsonSerializerOptions with a source-generated resolver for trimming and AOT.")]
[RequiresDynamicCode("Outbox stores serialize the message payload reflectively; supply JsonSerializerOptions with a source-generated resolver for trimming and AOT.")]
ValueTask EnqueueWithPayloadTransformAsync(IDispatchMessage message, IMessageContext context, Func<ReadOnlyMemory<byte>, string?, CancellationToken, ValueTask<byte[]>> transformPayload, CancellationToken cancellationToken)

Parameters

message IDispatchMessage

The message the provider serializes using its existing enqueue configuration.

context IMessageContext

The context the provider uses to construct its complete envelope before awaiting the transform.

transformPayload Func<ReadOnlyMemory<byte>, string, CancellationToken, ValueTask<byte[]>>

Receives the exact serialized bytes, the prepared envelope's tenant and the supplied cancellation token. Input memory is borrowed read-only and remains stable during invocation; do not mutate it or retain it for later changes. Return non-null callback-owned bytes. The provider copies that result before persistence, so later changes after acceptance cannot alter stored state. Concurrent mutation during the synchronous handoff copy is unsupported. This is not recursive cloning of header objects.

cancellationToken CancellationToken

Cancellation checked before preparation and after the transform, before accepting a write.

Returns

ValueTask

Completion of the provider's enqueue operation.

Remarks

A supplied transform runs exactly once, including empty payloads, before accepting any row mutation. Null results, callback faults and callback cancellation cause no accepting write or callback retry. A callback that cancels the supplied token but returns bytes is refused before acceptance. Once persistence starts, cancellation retains the provider's existing transaction and uncertainty semantics.

Exceptions

ArgumentNullException

Message, context or transform is null.

InvalidOperationException

The transform returns a null payload.