class Crabbit::SuperStreamProducer

Overview

Routes publishes across the current partitions of a RabbitMQ super stream.

Partition producers are created lazily and share SuperStreamProducerOptions#producer. Topology is refreshed on schedule and after routing failures.

Defined in:

crabbit/super_stream.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(environment : Environment, super_stream : String, options : SuperStreamProducerOptions) #

Creates a super-stream producer and resolves its initial topology.

Applications normally call Environment#super_stream_producer.


[View source]

Instance Method Detail

def close : Nil #

Idempotently closes all partition producers.


[View source]

Returns routing and partition-producer options.


[View source]
def publish(message : Message, routing_key : String | Nil = nil) : SuperStreamPublishHandle #

Routes and publishes an AMQP message.

routing_key overrides SuperStreamProducerOptions#routing_key_extractor. A custom routing strategy ignores both values.


[View source]
def publish(message : Message, routing_key : String | Nil = nil, &callback : Confirmation -> ) : SuperStreamPublishHandle #

Routes and publishes an AMQP message, invoking the block for each selected partition's confirmation.


[View source]
def publish(message : RawMessage | Bytes | String, routing_key : String) : SuperStreamPublishHandle #

Routes and publishes raw, byte, or string payloads using an explicit key.

RawMessage is passed through; Bytes and String are wrapped in an AMQP Data section by the partition producer.


[View source]
def super_stream : String #

Returns the logical super-stream name.


[View source]