Class: QueueingProxy::Frontend::Queuer

Inherits:
Thin::Connection
  • Object
show all
Defined in:
lib/queueing_proxy/frontend.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#beanstalksObject

Returns the value of attribute beanstalks.



43
44
45
# File 'lib/queueing_proxy/frontend.rb', line 43

def beanstalks
  @beanstalks
end

#loggerObject

Returns the value of attribute logger.



43
44
45
# File 'lib/queueing_proxy/frontend.rb', line 43

def logger
  @logger
end

Instance Method Details

#post_initObject



45
46
47
48
# File 'lib/queueing_proxy/frontend.rb', line 45

def post_init
  @data = ''
  super
end

#queue_dataObject



60
61
62
63
64
65
66
67
68
# File 'lib/queueing_proxy/frontend.rb', line 60

def queue_data
  if @data != ''
    beanstalks.each {|b|
      b.put(@data) {|id|
        logger.info "Frontend enqueued job #{id} to #{b}"
      }
    }
  end
end

#receive_data(data) ⇒ Object



50
51
52
53
# File 'lib/queueing_proxy/frontend.rb', line 50

def receive_data(data)
  @data << data
  super(data)
end

#unbindObject



55
56
57
58
# File 'lib/queueing_proxy/frontend.rb', line 55

def unbind
  queue_data
  super
end