Class: OMQ::DISH

Inherits:
Socket
  • Object
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 Method Summary collapse

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



78
79
80
81
82
83
# File 'lib/omq/radio_dish.rb', line 78

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)


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

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

#leave(group) ⇒ void

This method returns an undefined value.

Leaves a group.

Parameters:

  • group (String)


101
102
103
# File 'lib/omq/radio_dish.rb', line 101

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