Sha256: 0e2cb08b821d167a62a5d2bed7af64220d8ca987080492df9c327624e9f2547b

Contents?: true

Size: 1.11 KB

Versions: 15

Compression:

Stored size: 1.11 KB

Contents

# encoding: utf-8

module Qrack

  # Queue ancestor class
  class Queue

    # @return [AMQ::Client::Consumer] Default consumer (registered with {Queue#subscribe}).
    attr_accessor :default_consumer

    attr_reader :name, :client

    attr_accessor :delivery_tag


    # Returns consumer count from {Queue#status}.
    def consumer_count
      s = status
      s[:consumer_count]
    end

    # Returns message count from {Queue#status}.
    def message_count
      s = status
      s[:message_count]
    end

    # Publishes a message to the queue via the default nameless '' direct exchange.

    # @return [NilClass] nil
    # @deprecated
    # @note This method will be removed before 0.8 release.
    def publish(data, opts = {})
      Bunny.deprecation_warning("Qrack::Queue#publish", "0.8", "Use direct_exchange = bunny.exchange(''); direct_exchange.publish('message', key: queue.name) if you want to publish directly to one given queue. For more informations see https://github.com/ruby-amqp/bunny/issues/15 and for more theoretical explanation check http://bit.ly/nOF1CK")
      exchange.publish(data, opts)
    end

  end

end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
bunny-0.7.13 lib/qrack/queue.rb
bunny-0.7.12 lib/qrack/queue.rb
bunny-0.7.11 lib/qrack/queue.rb
bunny-0.7.10 lib/qrack/queue.rb
bunny-0.8.0 lib/qrack/queue.rb
sparqcode_bunny-0.0.2 lib/qrack/queue.rb
bunny-0.7.9 lib/qrack/queue.rb
sparqcode_bunny-0.0.1 lib/qrack/queue.rb
bunny-0.7.8 lib/qrack/queue.rb
bunny-0.7.6 lib/qrack/queue.rb
bunny-0.7.5 lib/qrack/queue.rb
bunny-0.7.4 lib/qrack/queue.rb
bunny-0.7.3 lib/qrack/queue.rb
bunny-0.7.2 lib/qrack/queue.rb
bunny-0.7.1 lib/qrack/queue.rb