Class: NNQ::BUS0

Inherits:
Socket show all
Defined in:
lib/nnq/bus.rb

Overview

BUS (nng bus0): best-effort bidirectional mesh. Every message sent goes to all directly connected peers. Every message received from any peer is delivered to the application. Self-pairing (BUS ↔ BUS).

Send never blocks — if a peer’s queue is full, the message is dropped for that peer (matching nng’s best-effort semantics).

Instance Attribute Summary

Attributes inherited from Socket

#options

Instance Method Summary collapse

Methods inherited from Socket

#all_peers_gone, bind, #bind, #close, #close_read, connect, #connect, #connection_count, #frozen_binary, #initialize, #last_endpoint, #monitor, #peer_connected, #raw?, #reconnect_enabled, #reconnect_enabled=

Constructor Details

This class inherits a constructor from NNQ::Socket

Instance Method Details

#receiveObject



21
22
23
# File 'lib/nnq/bus.rb', line 21

def receive
  Reactor.run { @engine.routing.receive }
end

#send(body) ⇒ Object



15
16
17
18
# File 'lib/nnq/bus.rb', line 15

def send(body)
  body = frozen_binary(body)
  Reactor.run { @engine.routing.send(body) }
end