Module: OMQ::Routing::FanOut
Overview
Mixin for routing strategies that fan-out to subscribers.
Manages per-connection subscription sets, subscription command listeners, and per-connection send queues/pumps that deliver to each matching peer independently.
HWM is enforced per subscriber: each connection gets its own bounded send queue. DropQueues (for :drop_newest/:drop_oldest) silently drop messages for a slow subscriber without affecting others. LimitedQueues (for :block) block the publisher.
Including classes must call ‘init_fan_out(engine)` from their #initialize.
Constant Summary collapse
- EMPTY_BINARY =
Shared frozen empty binary string to avoid repeated allocations.
::Protocol::ZMTP::Codec::EMPTY_BINARY
Instance Attribute Summary collapse
-
#subscriber_joined ⇒ Async::Promise
readonly
Resolves when the first subscriber joins.
Instance Method Summary collapse
-
#send_queues_drained? ⇒ Boolean
True when all per-connection send queues are empty.
Instance Attribute Details
#subscriber_joined ⇒ Async::Promise (readonly)
Returns resolves when the first subscriber joins.
26 27 28 |
# File 'lib/omq/routing/fan_out.rb', line 26 def subscriber_joined @subscriber_joined end |
Instance Method Details
#send_queues_drained? ⇒ Boolean
Returns true when all per-connection send queues are empty.
31 32 33 |
# File 'lib/omq/routing/fan_out.rb', line 31 def send_queues_drained? @conn_queues.values.all?(&:empty?) end |