Sha256: 9900690ca6048bbf54ff3ee408fb23b61fac45e8bc72b810716f89a77e8d6312
Contents?: true
Size: 758 Bytes
Versions: 3
Compression:
Stored size: 758 Bytes
Contents
# > bundle exec ruby examples/demo_priority.rb # # Priority Queue with message priorities # require 'pika_que' require 'pika_que/worker' PikaQue.logger.level = ::Logger::DEBUG class PriorityWorker include PikaQue::Worker from_queue "pika-que-priority", :arguments => { :'x-max-priority' => 10 } def perform(msg) logger.info msg['msg'] ack! end end begin pro = PikaQue::Processor.new(workers: [PriorityWorker], concurrency: 2) pro.start rescue => e puts e puts e.backtrace.join("\n") end sleep 3 pub = PikaQue::Publisher.new() 300.times do |i| prty = (i % 2) == 0 ? 1 : 10 pub.publish({ msg: "hello world #{i} priority #{prty}" }, routing_key: 'pika-que-priority', priority: prty) end sleep 3 pro.stop puts "bye" exit 1
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pika_que-0.3.0 | examples/demo_priority.rb |
pika_que-0.2.0 | examples/demo_priority.rb |
pika_que-0.1.6 | examples/demo_priority.rb |