Class: OMQ::Routing::Scatter
- Inherits:
-
Object
- Object
- OMQ::Routing::Scatter
- Includes:
- RoundRobin
- Defined in:
- lib/omq/routing/scatter.rb
Overview
SCATTER socket routing: round-robin send to GATHER peers.
Instance Method Summary collapse
- #connection_added(connection) ⇒ Object
- #connection_removed(connection) ⇒ Object
- #enqueue(parts) ⇒ Object
-
#initialize(engine) ⇒ Scatter
constructor
A new instance of Scatter.
-
#recv_queue ⇒ Object
SCATTER is write-only.
-
#stop ⇒ Object
Stops all background tasks (send pumps, reapers).
Constructor Details
#initialize(engine) ⇒ Scatter
Returns a new instance of Scatter.
12 13 14 15 16 |
# File 'lib/omq/routing/scatter.rb', line 12 def initialize(engine) @engine = engine @tasks = [] init_round_robin(engine) end |
Instance Method Details
#connection_added(connection) ⇒ Object
28 29 30 31 32 |
# File 'lib/omq/routing/scatter.rb', line 28 def connection_added(connection) @connections << connection add_round_robin_send_connection(connection) start_reaper(connection) end |
#connection_removed(connection) ⇒ Object
37 38 39 40 |
# File 'lib/omq/routing/scatter.rb', line 37 def connection_removed(connection) @connections.delete(connection) remove_round_robin_send_connection(connection) end |
#enqueue(parts) ⇒ Object
45 46 47 |
# File 'lib/omq/routing/scatter.rb', line 45 def enqueue(parts) enqueue_round_robin(parts) end |
#recv_queue ⇒ Object
SCATTER is write-only.
21 22 23 |
# File 'lib/omq/routing/scatter.rb', line 21 def recv_queue raise "SCATTER sockets cannot receive" end |
#stop ⇒ Object
Stops all background tasks (send pumps, reapers).
52 53 54 55 |
# File 'lib/omq/routing/scatter.rb', line 52 def stop @tasks.each(&:stop) @tasks.clear end |