View Source RabbitMQStream.Consumer.OffsetTracking behaviour (rabbitmq_stream v0.4.0)
Behavior for offset tracking strategies.
If you pass multiple strategies to the consumer, which will be executed in order, and
and halt after the first one that returns a :store
request.
Existing Strategies
You can use the default strategies by passing a shorthand alias:
Summary
Callbacks
Optional Callback executed after every chunk, which can be used to update the state.
Initializes the strategy state.
Callback responsible for deciding whether to store the offset, based on its internal state.
Types
@type t() :: module()
Callbacks
@callback after_chunk( state :: term(), chunk :: RabbitMQStream.OsirisChunk.t(), subscription :: RabbitMQStream.Consumer.t() ) :: term()
Optional Callback executed after every chunk, which can be used to update the state.
Useful, for example, to store the offset after a certain number of messages.
Initializes the strategy state.
Parameters
opts
- a keyword list of the options passed to the consumer, merged with the options passed to the strategy itself.
@callback run(state :: term(), subscription :: RabbitMQStream.Consumer.t()) :: {:store, state :: term()} | {:skip, state :: term()}
Callback responsible for deciding whether to store the offset, based on its internal state.
Parameters
state
- the state of the strategysubscription
- the state of the owner subscription process