Sha256: c7e2555db05fb22c0abb41393f053e5ff1ac9069b4491f7d21fced922dbe10ec
Contents?: true
Size: 835 Bytes
Versions: 3
Compression:
Stored size: 835 Bytes
Contents
# Provides common behavior shared by the Bunny and HotBunnies dispatchers. class Woodhouse::Dispatchers::CommonAmqpDispatcher < Woodhouse::Dispatcher private # Yields an AMQP channel to the block, doing any error handling or synchronization # necessary. def run(&blk) raise NotImplementedError end def deliver_job(job) run do |client| exchange = client.exchange(job.exchange_name, :type => :headers) publish_job(job, exchange) end end def deliver_job_update(job, data) run do |client| exchange = client.exchange("woodhouse.progress", :type => :direct) # establish durable queue to pick up updates client.queue(job.job_id, :durable => true).bind(exchange, :routing_key => job.job_id) exchange.publish(data.to_json, :routing_key => job.job_id) end end end
Version data entries
3 entries across 3 versions & 1 rubygems