Framework.Sequencer.BehaviorConsumer behaviour (Framework v0.5.0)
View SourceBehavior for sequencer event consumers.
Defines the contract that all consumers must implement for consumer conformance. Consumers must:
- Persist cursors in consumer_cursors table
- Resume from > last_processed_sequence after restart
- Handle sequence gaps without failure
- Remain stable during NOTIFY storms
- Use range-scan for correctness (NOTIFY as wake hint only)
- Never infer order from timestamps - sequence only
Consumer Implementation Example
defmodule MyApp.EventConsumer do
use Framework.Sequencer.Consumer
def handle_events(events) do
Enum.each(events, &process_event/1)
:ok
end
defp process_event(event) do
# Process event payload
:ok
end
end
Summary
Callbacks
Process a batch of events in sequence order.