Change delivery and reconciliation

Copy Markdown View Source

Use this page when consuming Arcadic.Changes events for indexes, caches, or other derived state. The WebSocket feed delivers changes at most once on a best-effort basis. Reconcile derived state after a delivery gap.

Start Arcadic.Changes under your supervisor, call Arcadic.Changes.subscribe/3, and receive {:arcadic_change, %Arcadic.Changes.Event{}} in the subscriber process. Install mint_web_socket using the range in Compatibility.

DeliveryWhat to do
:reconnected changeReconcile affected subscriptions. The server has no replay or checkpoint for the disconnected interval.
:overflow changeReconcile all subscribed databases. The client drops its oldest buffered items and the marker has no database.
{:arcadic_change_error, :unauthorized}Reestablish the feed with current credentials. The handshake fails and the process stops.
{:arcadic_change_error, :subscribe_rejected}Check the requested subscription. The socket stays open.

A process binds to one subscriber. When the subscriber exits, the process stops. :max_buffer limits Arcadic's buffer, while the subscriber owns its mailbox and must keep up with deliveries. See the Operations tutorial for a supervised subscription and reconciliation markers.