Class: ZZQ::Broker
Overview
MQTT broker. Owns the session map (by client id), retained-message store, topic trie, and shared-subscription groups.
M3 stub: constructor + #build_routing. CONNECT handling, subscription matching, and retained store come in M7.
Instance Attribute Summary
Attributes inherited from Socket
Instance Method Summary collapse
- #build_routing(engine) ⇒ Object
-
#ingest(message) ⇒ Object
(also: #<<)
Inject a Message into the broker’s delivery path as if it had arrived via a PUBLISH packet.
-
#session_count ⇒ Object
Number of currently-connected MQTT sessions.
Methods inherited from Socket
#all_peers_gone, bind, #bind, #close, #coerce_binary, connect, #connect, #connection_count, #initialize, #last_endpoint, #monitor, #peer_connected
Constructor Details
This class inherits a constructor from ZZQ::Socket
Instance Method Details
#build_routing(engine) ⇒ Object
12 13 14 |
# File 'lib/zzq/broker.rb', line 12 def build_routing(engine) Routing::Broker.new(engine) end |
#ingest(message) ⇒ Object Also known as: <<
Inject a Message into the broker’s delivery path as if it had arrived via a PUBLISH packet. Fans out to every matching subscriber. Use this to bridge non-MQTT inputs (NNQ, OMQ, a file) into broker topics.
25 26 27 28 29 |
# File 'lib/zzq/broker.rb', line 25 def ingest() raise NotInAsyncContext unless Async::Task.current? @engine.routing.() nil end |
#session_count ⇒ Object
Number of currently-connected MQTT sessions.
18 |
# File 'lib/zzq/broker.rb', line 18 def session_count = @engine.routing.session_count |