Sha256: 93b3362c06fe0bfacd713b51661ede0b7dc21b4f34a02cad96b620167bd45ee9
Contents?: true
Size: 818 Bytes
Versions: 1
Compression:
Stored size: 818 Bytes
Contents
require 'carrot' module MessageQueue class Rabbit < Base def initialize(opts={}) @servers = opts[:servers] @info = {} @host, @port = @servers.first.split(':') @port = @port.to_i end def delete(queue) client.queue(queue).delete end def queue_size(queue) client.queue(queue).message_count end def enqueue(queue, data) client.queue(queue, :durable => true).publish(Marshal.dump(data), :persistent => true) end def dequeue(queue) task = client.queue(queue).pop(:ack => true) return unless task Marshal.load(task) end def confirm(queue) client.queue(queue).ack end def client @client ||= Carrot.new(:host => @host, :port => @port) end def stop client.stop end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
famoseagle-sweat_shop-0.5.0 | lib/message_queue/rabbit.rb |