Class: OMQ::DISH

Inherits:
Socket show all
Includes:
Readable
Defined in:
lib/omq/radio_dish.rb

Overview

Group-based subscriber socket (ZeroMQ RFC 48).

Receives messages from RADIO peers for joined groups. Supports both TCP and UDP transports.

Instance Attribute Summary

Attributes inherited from Socket

#engine, #options

Instance Method Summary collapse

Methods included from Readable

#receive, #wait_readable

Methods included from QueueReadable

#dequeue, #each, #wait

Methods inherited from Socket

#all_peers_gone, #attach_endpoints, bind, #bind, #close, #close_read, connect, #connect, #connection_count, #disconnect, #finalize_init, #init_engine, #inspect, #monitor, #peer_connected, #reconnect_enabled=, #set_unbounded, #stop, #subscriber_joined, #unbind

Constructor Details

#initialize(endpoints = nil, linger: Float::INFINITY, group: nil, on_mute: :block, backend: nil) ⇒ DISH

Creates a new DISH socket.

Parameters:

  • endpoints (String, Array<String>, nil) (defaults to: nil)

    endpoint(s) to connect to

  • linger (Numeric) (defaults to: Float::INFINITY)

    linger period in seconds (Float::INFINITY = wait forever, 0 = drop)

  • group (String, nil) (defaults to: nil)

    initial group to join

  • on_mute (Symbol) (defaults to: :block)

    behaviour when HWM is reached (:block or :drop_newest)

  • backend (Object, nil) (defaults to: nil)

    optional transport backend



91
92
93
94
95
96
# File 'lib/omq/radio_dish.rb', line 91

def initialize(endpoints = nil, linger: Float::INFINITY, group: nil, on_mute: :block, backend: nil)
  init_engine(:DISH, on_mute: on_mute, backend: backend)
  @options.linger = linger
  attach_endpoints(endpoints, default: :connect)
  join(group) if group
end

Instance Method Details

#join(group) ⇒ void

This method returns an undefined value.

Joins a group.

Parameters:

  • group (String)


104
105
106
# File 'lib/omq/radio_dish.rb', line 104

def join(group)
  @engine.routing.join(group)
end

#leave(group) ⇒ void

This method returns an undefined value.

Leaves a group.

Parameters:

  • group (String)


114
115
116
# File 'lib/omq/radio_dish.rb', line 114

def leave(group)
  @engine.routing.leave(group)
end