Class: Qrack::Queue

Inherits:
Object
  • Object
show all
Defined in:
lib/qrack/queue.rb

Overview

Queue ancestor class

Direct Known Subclasses

Bunny::Queue, Bunny::Queue09

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



11
12
13
# File 'lib/qrack/queue.rb', line 11

def client
  @client
end

#default_consumerAMQ::Client::Consumer

Returns Default consumer (registered with Queue#subscribe).

Returns:

  • (AMQ::Client::Consumer)

    Default consumer (registered with Queue#subscribe).



9
10
11
# File 'lib/qrack/queue.rb', line 9

def default_consumer
  @default_consumer
end

#delivery_tagObject

Returns the value of attribute delivery_tag.



13
14
15
# File 'lib/qrack/queue.rb', line 13

def delivery_tag
  @delivery_tag
end

#nameObject (readonly)

Returns the value of attribute name.



11
12
13
# File 'lib/qrack/queue.rb', line 11

def name
  @name
end

Instance Method Details

#consumer_countObject

Returns consumer count from Queue#status.



17
18
19
20
# File 'lib/qrack/queue.rb', line 17

def consumer_count
  s = status
  s[:consumer_count]
end

#message_countObject

Returns message count from Queue#status.



23
24
25
26
# File 'lib/qrack/queue.rb', line 23

def message_count
  s = status
  s[:message_count]
end

#publish(data, opts = {}) ⇒ NilClass

Deprecated.
Note:

This method will be removed before 0.8 release.

Returns nil.

Returns:

  • (NilClass)

    nil



33
34
35
36
# File 'lib/qrack/queue.rb', line 33

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