Class: OMQ::Routing::Push

Inherits:
Object
  • Object
show all
Includes:
RoundRobin
Defined in:
lib/omq/routing/push.rb

Overview

PUSH socket routing: round-robin send to PULL peers.

Constant Summary

Constants included from RoundRobin

RoundRobin::BATCH_BYTE_CAP, RoundRobin::BATCH_MSG_CAP

Instance Method Summary collapse

Methods included from RoundRobin

#send_queues_drained?

Constructor Details

#initialize(engine) ⇒ Push

Returns a new instance of Push.

Parameters:



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

def initialize(engine)
  @engine = engine
  init_round_robin(engine)
end

Instance Method Details

#connection_added(connection) ⇒ Object

Parameters:

  • connection (Protocol::ZMTP::Connection)


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

def connection_added(connection)
  add_round_robin_send_connection(connection)
  start_reaper(connection)
end

#connection_removed(connection) ⇒ Object

Parameters:

  • connection (Protocol::ZMTP::Connection)


46
47
48
49
# File 'lib/omq/routing/push.rb', line 46

def connection_removed(connection)
  @connections.delete(connection)
  remove_round_robin_send_connection(connection)
end

#dequeue_recvObject



27
28
29
# File 'lib/omq/routing/push.rb', line 27

def dequeue_recv
  raise "PUSH sockets cannot receive"
end

#enqueue(parts) ⇒ Object

Parameters:

  • parts (Array<String>)


54
55
56
# File 'lib/omq/routing/push.rb', line 54

def enqueue(parts)
  enqueue_round_robin(parts)
end

#recv_queueObject

PUSH is write-only. Engine-facing recv contract: dequeue raises, unblock is a no-op (fatal-error propagation still calls it).



22
23
24
# File 'lib/omq/routing/push.rb', line 22

def recv_queue
  raise "PUSH sockets cannot receive"
end

#unblock_recvObject



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

def unblock_recv
end