FixAlchemy.MessageStore behaviour (FIXAlchemy v0.2.0)

View Source

Storage for sent messages so a session can answer a ResendRequest.

Only sessions with :sequence_recovery enabled store anything. Implement this behaviour and pass the module as :message_store to back a session with durable storage — recovery across a process restart, rather than only across a reconnect, requires a store that outlives the client process.

FixAlchemy.MessageStore.Memory is the default: fast, per-session, and discarded when the session ends.

Summary

Callbacks

Fetch stored messages in the inclusive range, ascending by sequence number.

Record an outbound message under its MsgSeqNum.

Drop everything, as a sequence reset requires.

Types

t()

@type t() :: term()

Callbacks

fetch_range(store, begin_seq, end_seq)

@callback fetch_range(store :: t(), begin_seq :: pos_integer(), end_seq :: pos_integer()) ::
  [
    {pos_integer(), binary()}
  ]

Fetch stored messages in the inclusive range, ascending by sequence number.

Missing sequence numbers are simply absent from the result; the caller gap-fills them.

new(opts)

@callback new(opts :: keyword()) :: t()

put(store, seq, message)

@callback put(store :: t(), seq :: pos_integer(), message :: binary()) :: t()

Record an outbound message under its MsgSeqNum.

reset(store)

@callback reset(store :: t()) :: t()

Drop everything, as a sequence reset requires.