Class ExchangeSnapshotCodec

Assembly: redb.Tsak.Core.dll

Serializes an snapshot for durable storage and rehydrates it back into a
fresh exchange for replay. The rehydrated exchange carries no DI scope — the route tail resolves
redb/SQL lazily from the context provider on replay (fresh connections, cleaned up by
ReleaseScopes), so no scope needs to be reattached here.

Body fidelity: byte[] and string round-trip exactly; other bodies go through
System.Text.Json (best-effort — the exact CLR type is restored when its assembly is loadable,
otherwise the body comes back as a ). A body that cannot be serialized at
all is stored with BodyKind=none and Replayable=false — the entry stays visible but
is not durably replayable (§fork-2 limitation).


Attachments: the message attachments are stored with their metadata and content (base64, like a
byte[] body) and come back as byte content in their order. Their size is bounded before they get
here: the checkpoint the entry comes from is not taken when the attachments exceed
RedbRoute:Attachments:MaxReplayableBytes, so such an exchange leaves no entry to store.

public static class ExchangeSnapshotCodec

Inheritance

Object→ExchangeSnapshotCodec

Methods

Rehydrate(SerializedSnapshot)

Rebuilds a fresh exchange from stored data, ready for IRouteContext.ReplayAsync.

public static IExchange Rehydrate(SerializedSnapshot s)

Serialize(IExchange)

public static SerializedSnapshot Serialize(IExchange snapshot)