Sha256: 88a692bb939930d505e4d5436f0af85d09bae1f95713d26c536a7fb1bb059c4f
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
# # A Dispatcher implementation that uses hot_bunnies, a JRuby AMQP client using the # Java client for RabbitMQ. This class can be loaded if hot_bunnies is not # available, but it will fail upon initialization. If you want to use this # runner (it's currently the only one that works very well), make sure to # add # # gem 'hot_bunnies' # # to your Gemfile. # require 'woodhouse/dispatchers/common_amqp_dispatcher' class Woodhouse::Dispatchers::HotBunniesDispatcher < Woodhouse::Dispatchers::CommonAmqpDispatcher begin require 'hot_bunnies' rescue LoadError => err define_method(:initialize) {|*args| raise err } else def initialize(config) super new_connection @mutex = Mutex.new end end private def run @mutex.synchronize do yield @channel end end def publish_job(job, exchange) exchange.publish(job.payload, :properties => { :headers => job.arguments }) end def new_connection @connection = HotBunnies.connect(@config.server_info) @channel = @connection.create_channel end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
woodhouse-0.1.2 | lib/woodhouse/dispatchers/hot_bunnies_dispatcher.rb |
woodhouse-0.1.1 | lib/woodhouse/dispatchers/hot_bunnies_dispatcher.rb |