struct

Crabbit::Configuration

Inherits Struct < Value < Object

Immutable connection, authentication, timeout, and protocol configuration.

Configuration.parse is convenient for one URI endpoint. Construct this type directly to supply multiple entrypoints, custom SASL, or load-balancer mode.

Constants

DEFAULT_URI = "rabbitmq-stream://guest:guest@localhost:5552/%2f"

Default local RabbitMQ Stream URI.

Constructors

new(endpoints : Array(Endpoint) = [Endpoint.new("localhost")], username : String = "guest", password : String = "guest", virtual_host : String = "/", sasl : SaslMechanism = SaslMechanism::Plain, sasl_authenticator : SaslAuthenticator | Nil = nil, oauth2 : OAuth2Config | Nil = nil, tls : TLSConfig | Nil = nil, heartbeat : Time::Span = 60.seconds, max_frame_size : UInt32 = 1048576_u32, connection_timeout : Time::Span = 10.seconds, request_timeout : Time::Span = 10.seconds, client_properties : Hash(String, String) = {} of String => String, load_balancer : Bool = false)

Creates a connection configuration.

Crabbit rotates through endpoints for locator connections. With load_balancer, it also opens producer and consumer connections through those entrypoints until RabbitMQ advertises the metadata-selected node.

client_properties augment the default product, version, platform, and information fields. Supplying oauth2 creates a shared OAuth2SaslAuthenticator; oauth2 and sasl_authenticator are mutually exclusive.

Source
parse(uri : String = DEFAULT_URI, tls : TLSConfig | Nil = nil, **options) : self

Parses a RabbitMQ Stream URI into a configuration.

Supported schemes are rabbitmq-stream and rabbitmq-stream+tls. Username, password, and virtual host are percent-decoded. Additional named options are forwarded to .new.

tls = Crabbit::TLSConfig.new(custom_context)
config = Crabbit::Configuration.parse(
  "rabbitmq-stream+tls://user:secret@rabbit.example/%2f",
  tls: tls,
  heartbeat: 30.seconds,
)
Source

Instance methods

authenticator

Returns the effective authenticator for this configuration.

Source
client_properties

Returns client properties sent during Peer Properties negotiation.

Source
connection_timeout

Returns the TCP/TLS connection timeout.

Source
endpoints

Returns seed endpoints used for metadata and load-balanced connections.

Source
heartbeat

Returns the requested heartbeat interval; zero disables heartbeats.

Source
load_balancer

Returns whether broker connections must be reached through seed endpoints.

Source
max_frame_size

Returns the requested maximum frame size; zero means no local limit.

Source
oauth2

Returns the optional OAuth 2 configuration.

Source
password

Returns the SASL PLAIN password.

Source
request_timeout

Returns the timeout for correlated protocol requests.

Source
sasl

Returns the selected built-in SASL mechanism.

Source
sasl_authenticator

Returns the optional custom SASL authenticator.

Source
tls

Returns TLS settings, or nil for plain Stream connections.

Source
username

Returns the SASL PLAIN username.

Source
virtual_host

Returns the RabbitMQ virtual host.

Source