ExStorageService.Metadata.Outbox (ex_storage_service v0.6.4)

Copy Markdown View Source

Materializes committed outbox events into durable, independently leased jobs.

The job and the event's dispatched state are written in one Concord transaction. Replaying an operation is therefore safe and returns the existing job instead of creating duplicate work.

Summary

Functions

enqueue_legacy(events, opts \\ [])

@spec enqueue_legacy(
  [map()],
  keyword()
) :: :ok | {:error, term()}

materialize(operation_id, opts \\ [])

@spec materialize(
  binary(),
  keyword()
) :: {:ok, [ExStorageService.Metadata.Models.Job.t()]} | {:error, term()}

materialize_page(cursor \\ nil, limit \\ 100, opts \\ [])

@spec materialize_page(binary() | nil, pos_integer(), keyword()) ::
  {:ok,
   %{
     jobs: [ExStorageService.Metadata.Models.Job.t()],
     next_cursor: binary() | nil
   }}
  | {:error, term()}