class Crabbit::ProducerOptions

Overview

Configures publisher batching, confirms, filtering, backpressure, and recovery.

Defined in:

crabbit/options.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(name : String | Nil = nil, batch_size : Int32 = 100, sub_entry_size : Int32 = 1, compression : Compression = Compression::None, max_unconfirmed : Int32 = 10000, batch_delay : Time::Span = 100.milliseconds, confirm_timeout : Time::Span = 30.seconds, enqueue_timeout : Time::Span | Nil = nil, retry_on_recovery : Bool = true, filter_value_extractor : Proc(Message, String | Nil) | Nil = nil, recovery_policy : RecoveryPolicy = RecoveryPolicy.new, on_state_change : Proc(ResourceEvent, Nil) | Nil = nil) #

Creates publisher options.

A non-nil name enables broker-side publishing-ID deduplication and sequence recovery. batch_size controls ordinary wire batching; sub_entry_size greater than one packs logical messages into compressed sub-entries. Filtering and sub-entry batching cannot be combined.

max_unconfirmed applies backpressure. With no enqueue_timeout, the publishing fiber waits indefinitely for capacity. confirm_timeout limits how long an unresolved publish remains pending. When retry_on_recovery is true, pending messages are sent again after the publisher reconnects.


[View source]

Instance Method Detail

def batch_delay : Time::Span #

Returns how long the batch worker waits for more messages.


[View source]
def batch_size : Int32 #

Returns the maximum number of logical messages collected per wire batch.


[View source]
def compression : Compression #

Returns the compression used for sub-entry batches.


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

Returns the default publisher-confirmation timeout.


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

Returns the optional timeout for waiting on backpressure capacity.


[View source]
def filter_value_extractor : Proc(Message, String | Nil) | Nil #

Returns the optional server-side filter value extractor.


[View source]
def max_unconfirmed : Int32 #

Returns the hard limit of publishes awaiting confirmation.


[View source]
def name : String | Nil #

Returns the optional publisher reference used for broker deduplication.


[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 retry_on_recovery : Bool #

Returns whether unresolved messages are republished after recovery.


[View source]
def sub_entry_size : Int32 #

Returns the number of logical messages packed into each sub-entry.


[View source]