job (Minion)

    # File lib/minion.rb, line 36
            def job(queue, options = {}, &blk)
                    handler = Minion::Handler.new queue
                    handler.when = options[:when] if options[:when]
                    handler.unsub = lambda do
                            log "unsubscribing to #{queue}"
                            MQ.queue(queue).unsubscribe
                    end
                    handler.sub = lambda do
                            log "subscribing to #{queue}"
                            MQ.queue(queue).subscribe(:ack => true) do |h,m|
                                    return if AMQP.closing?
                                    begin
                                            log "recv: #{queue}:#{m}"

                                            args = decode_json(m)

                                            result = yield(args)

                                            next_job(args, result)
                                    rescue Object => e
                                            raise unless error_handler
                                            error_handler.call(e,queue,m,h)
                                    end
                                    h.ack
                                    check_all
                            end
                    end
                    @@handlers ||= []
                    at_exit { Minion.run } if @@handlers.size == 0
                    @@handlers << handler
            end