View Source RabbitMQStream.Consumer.FlowControl behaviour (rabbitmq_stream v0.4.0)

Behavior for flow control strategies.

Existing Strategies

You can use the default strategies by passing a shorthand alias:

Summary

Callbacks

Initializes the strategy state.

Callback responsible for deciding whether to add more credit, based on its internal state.

Types

Callbacks

@callback init(opts :: term()) :: term()

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.
Link to this callback

run(state, subscription)

View Source
@callback run(state :: term(), subscription :: RabbitMQStream.Consumer.t()) ::
  {:credit, amount :: non_neg_integer(), state :: term()}
  | {:skip, state :: term()}

Callback responsible for deciding whether to add more credit, based on its internal state.

Parameters

  • state - the state of the strategy
  • subscription - the state of the owner subscription process