Class: OMQ::Routing::Gather

Inherits:
Object
  • Object
show all
Includes:
FairRecv
Defined in:
lib/omq/routing/gather.rb

Overview

GATHER socket routing: fair-queue receive from SCATTER peers.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(engine) ⇒ Gather

Returns a new instance of Gather.

Parameters:

  • engine (Engine)


12
13
14
15
16
# File 'lib/omq/routing/gather.rb', line 12

def initialize(engine)
  @engine     = engine
  @recv_queue = FairQueue.new
  @tasks      = []
end

Instance Attribute Details

#recv_queueFairQueue (readonly)

Returns:

  • (FairQueue)


21
22
23
# File 'lib/omq/routing/gather.rb', line 21

def recv_queue
  @recv_queue
end

Instance Method Details

#connection_added(connection) ⇒ Object

Parameters:

  • connection (Connection)


25
26
27
# File 'lib/omq/routing/gather.rb', line 25

def connection_added(connection)
  add_fair_recv_connection(connection)
end

#connection_removed(connection) ⇒ Object

Parameters:

  • connection (Connection)


32
33
34
# File 'lib/omq/routing/gather.rb', line 32

def connection_removed(connection)
  @recv_queue.remove_queue(connection)
end

#enqueue(_parts) ⇒ Object

GATHER is read-only.



39
40
41
# File 'lib/omq/routing/gather.rb', line 39

def enqueue(_parts)
  raise "GATHER sockets cannot send"
end

#stopObject

Stops all background tasks.



45
46
47
48
# File 'lib/omq/routing/gather.rb', line 45

def stop
  @tasks.each(&:stop)
  @tasks.clear
end