Sha256: 4713f9ea7eca0daecde70d2ee2706799b081eb454e12f4b3ca2f4272b513d88a
Contents?: true
Size: 713 Bytes
Versions: 2
Compression:
Stored size: 713 Bytes
Contents
# class Topic # def initialize(name,opts={}) # @exchange = MQ.topic(name,opts) # end # def publish(key,payload,opts={}) # @exchange.publish(::Marshal.dump(payload),opts.merge(:routing_key => key)) # end # def subscribe(matcher,opts={},&block) # ack = opts.delete(:ack) # uid = "#{@exchange.name}.topic.#{rand 999_999_999_999}" # q = MQ.queue(uid,opts) # q.bind(@exchange.name,:key => matcher) # q.subscribe(:ack => ack) { |info,payload| # payload = ::Marshal.load(payload) # if block.arity == 2 # block.call(info,payload) # else # block.call(payload) # end # } # q # end # end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
ASS-0.1.0 | lib/ass/topic.rb |
jamesgolick-ASS-0.1.0 | lib/ass/topic.rb |