class Crabbit::ConsumerOptions

Overview

Configures subscription position, credit, processing, offset storage, filtering, Single Active Consumer behavior, and recovery.

Defined in:

crabbit/options.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(name : String | Nil = nil, offset : OffsetSpecification = OffsetSpecification.next, initial_credit : UInt16 = 10_u16, filters : Array(String) = [] of String, match_unfiltered : Bool = false, single_active_consumer : Bool = false, super_stream : String | Nil = nil, concurrency : Int32 = 1, buffer_size : Int32 = 1024, validate_crc : Bool = true, auto_store_every : Int32 | Nil = nil, auto_store_interval : Time::Span | Nil = nil, recovery_policy : RecoveryPolicy = RecoveryPolicy.new, on_consumer_update : Proc(Bool, OffsetSpecification) | Nil = nil, on_consumer_update_context : Proc(ConsumerUpdateContext, OffsetSpecification) | Nil = nil, subscription_offset : Proc(String, OffsetSpecification) | Nil = nil, on_state_change : Proc(ResourceEvent, Nil) | Nil = nil, topology_refresh : Time::Span = 30.seconds) #

Creates consumer options.

initial_credit is measured in chunks, while buffer_size is measured in logical messages. Callback consumers use concurrency handler fibers; pull consumers ignore it. Broker filtering accepts multiple OR-matched filters and can optionally include unfiltered messages.

Automatic storage requires name. #auto_store_every stores after a number of processed deliveries, and #auto_store_interval stores the latest contiguous processed offset periodically. With Single Active Consumer enabled, one of the update callbacks may choose the offset each time the subscription becomes active or inactive.


[View source]

Instance Method Detail

def auto_store_every : Int32 | Nil #

Returns the optional processed-message threshold for automatic offset storage.


[View source]
def auto_store_interval : Time::Span | Nil #

Returns the optional interval for automatic offset storage.


[View source]
def buffer_size : Int32 #

Returns the capacity of the logical delivery queue.


[View source]
def concurrency : Int32 #

Returns the number of callback-processing fibers.


[View source]
def filters : Array(String) #

Returns the server-side filter values.


[View source]
def initial_credit : UInt16 #

Returns the initial number of broker chunks that may be in flight.


[View source]
def match_unfiltered : Bool #

Returns whether messages without a filter value also match.


[View source]
def name : String | Nil #

Returns the optional consumer reference used for stored offsets and SAC.


[View source]
def offset : OffsetSpecification #

Returns the initial subscription position.


[View source]
def on_consumer_update : Proc(Bool, OffsetSpecification) | Nil #

Returns the legacy Single Active Consumer update listener.


[View source]
def on_consumer_update_context : Proc(ConsumerUpdateContext, OffsetSpecification) | Nil #

Returns the context-aware Single Active Consumer update listener.


[View source]
def on_state_change : Proc(ResourceEvent, Nil) | Nil #

Returns the optional asynchronous lifecycle listener.


[View source]
def recovery_policy : RecoveryPolicy #

Returns the reconnect backoff policy.


[View source]
def single_active_consumer : Bool #

Returns whether Single Active Consumer semantics are enabled.


[View source]
def subscription_offset : Proc(String, OffsetSpecification) | Nil #

Returns the optional per-partition starting-offset resolver.


[View source]
def super_stream : String | Nil #

Returns the parent super-stream name added to subscription properties.


[View source]
def topology_refresh : Time::Span #

Returns the super-stream partition refresh interval.


[View source]
def validate_crc : Bool #

Returns whether Deliver chunk CRC32 values are verified.


[View source]