Method: QRPC::Client::Dispatcher#input_queue

Defined in:
lib/qrpc/client/dispatcher.rb

#input_queue(&block) ⇒ Object

Returns input queue.

Parameters:

  • block (Proc)

    block to which will be input queue given

Since:

  • 0.3.0



209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/qrpc/client/dispatcher.rb', line 209

def input_queue(&block)
    if @input_queue.nil?
        @input_queue = EMJack::Connection::new(:host => @locator.host, :port => @locator.port)
        @input_queue.watch(self.input_name.to_s) do
            @input_queue.ignore("default") do

                # Results pooler error handler
                @input_queue.on_error do |error|
                    raise ::Exception::new("Beanstalk error: " << error.to_s)
                end
                
                # Returns
                block.call(@input_queue)
                
            end
        end
    else
        block.call(@input_queue)
    end
end