Class: OMQ::ROUTER
- Defined in:
- lib/omq/router_dealer.rb
Overview
ROUTER socket.
Constant Summary
Constants included from Writable
Instance Attribute Summary
Attributes inherited from Socket
#engine, #last_tcp_port, #options
Instance Method Summary collapse
-
#initialize(endpoints = nil, linger: Float::INFINITY, send_hwm: nil, recv_hwm: nil, send_timeout: nil, recv_timeout: nil, backend: nil, &block) ⇒ ROUTER
constructor
A new instance of ROUTER.
-
#send_to(receiver, message) ⇒ self
Sends a message to a specific peer by identity.
Methods included from Writable
Methods included from QueueWritable
Methods included from Readable
Methods included from QueueReadable
Methods inherited from Socket
#all_peers_gone, #attach_endpoints, bind, #bind, #close, #close_read, connect, #connect, #connection_count, #disconnect, #finalize_init, #init_engine, #inspect, #last_endpoint, #monitor, #peer_connected, #reconnect_enabled=, #set_unbounded, #stop, #subscriber_joined, #unbind
Constructor Details
#initialize(endpoints = nil, linger: Float::INFINITY, send_hwm: nil, recv_hwm: nil, send_timeout: nil, recv_timeout: nil, backend: nil, &block) ⇒ ROUTER
Returns a new instance of ROUTER.
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/omq/router_dealer.rb', line 47 def initialize(endpoints = nil, linger: Float::INFINITY, send_hwm: nil, recv_hwm: nil, send_timeout: nil, recv_timeout: nil, backend: nil, &block) init_engine(:ROUTER, send_hwm: send_hwm, recv_hwm: recv_hwm, send_timeout: send_timeout, recv_timeout: recv_timeout, backend: backend) @options.linger = linger attach_endpoints(endpoints, default: :bind) finalize_init(&block) end |
Instance Method Details
#send_to(receiver, message) ⇒ self
Sends a message to a specific peer by identity.
66 67 68 69 |
# File 'lib/omq/router_dealer.rb', line 66 def send_to(receiver, ) parts = .is_a?(Array) ? : [] send([receiver, '', *parts]) end |