Sha256: 5434454a7a776eaa6630962ee4052efada4d0f93cf97418882736f4b84c74bae

Contents?: true

Size: 505 Bytes

Versions: 1

Compression:

Stored size: 505 Bytes

Contents

require 'vx/common/amqp'
require 'vx/message'

module Vx
  module Worker
    class JobsConsumer

      include Vx::Common::AMQP::Consumer

      exchange 'vx.jobs'
      queue    'vx.worker.jobs'
      ack      true

      model Message::PerformJob

      def perform(message)
        job         = Job.new message
        number      = Thread.current[:consumer_id] || 0
        path_prefix = "/tmp/.worker/job.#{number}"
        Worker.perform(job, path_prefix)
        ack!
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vx-worker-0.3.0.pre1 lib/vx/worker/consumers/jobs_consumer.rb