Class: WindUp::QueueProxy

Inherits:
Celluloid::ActorProxy
  • Object
show all
Defined in:
lib/wind_up/queue_proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(manager) ⇒ QueueProxy

Returns a new instance of QueueProxy.



4
5
6
7
8
9
10
11
12
# File 'lib/wind_up/queue_proxy.rb', line 4

def initialize(manager)
  @mailbox       = manager.router
  @klass         = manager.worker_class.to_s
  @sync_proxy    = ::Celluloid::SyncProxy.new(@mailbox, @klass)
  @async_proxy   = ::Celluloid::AsyncProxy.new(@mailbox, @klass)
  @future_proxy  = ::Celluloid::FutureProxy.new(@mailbox, @klass)

  @manager_proxy = manager
end

Instance Method Details

#__manager__Object

Escape route to access the QueueManager actor from the QueueProxy



15
16
17
# File 'lib/wind_up/queue_proxy.rb', line 15

def __manager__
  @manager_proxy
end

#alive?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/wind_up/queue_proxy.rb', line 28

def alive?
  __manager__.alive?
end

#inspectObject



32
33
34
35
# File 'lib/wind_up/queue_proxy.rb', line 32

def inspect
  orig = super
  orig.sub("Celluloid::ActorProxy", "WindUp::QueueProxy")
end

#terminateObject

Reroute termination/alive? to the queue manager



20
21
22
# File 'lib/wind_up/queue_proxy.rb', line 20

def terminate
  __manager__.terminate
end

#terminate!Object



24
25
26
# File 'lib/wind_up/queue_proxy.rb', line 24

def terminate!
  __manager__.terminate!
end