Browse files

API reference docs

[ci skip]
  • Loading branch information...
1 parent 6eaf308 commit c1b29569ede6ee92768da07edebec4dc2938befe Michael Klishin committed Jan 21, 2013
Showing with 18 additions and 14 deletions.
  1. +1 −1 lib/bunny/channel.rb
  2. +6 −2 lib/bunny/consumer.rb
  3. +2 −2 lib/bunny/exchange.rb
  4. +9 −9 lib/bunny/queue.rb
View
2 lib/bunny/channel.rb
@@ -568,7 +568,7 @@ def basic_get(queue, opts = {:ack => true})
# @param [Integer] prefetch_count How many messages can consumers on this channel be given at a time
# (before they have to acknowledge or reject one of the earlier received messages)
# @param [Boolean] global (false) Ignored, as it is not supported by RabbitMQ
- # @param [AMQ::Protocol::Basic::QosOk] RabbitMQ response
+ # @return [AMQ::Protocol::Basic::QosOk] RabbitMQ response
# @see Bunny::Channel#prefetch
# @see http://rubybunny.info/articles/queues.html Queues and Consumers guide
# @api public
View
8 lib/bunny/consumer.rb
@@ -22,10 +22,14 @@ class Consumer
attr_reader :exclusive
- #
# @param [Bunny::Channel] channel Channel this consumer will use
# @param [Bunny::Queue,String] queue Queue messages will be consumed from
- # @param
+ # @param [String] consumer_tag Consumer tag (unique identifier). Generally it is better to let Bunny generate one.
+ # Empty string means RabbitMQ will generate consumer tag.
+ # @param [Boolean] no_ack (false) If false, delivered messages will be automatically acknowledged.
+ # If true, manual acknowledgements will be necessary.
+ # @param [Boolean] exclusive (false) Should this consumer be exclusive?
+ # @param [Hash] arguments (nil) Optional arguments that may be used by RabbitMQ extensions, etc
# @api public
def initialize(channel, queue, consumer_tag = channel.generate_consumer_tag, no_ack = true, exclusive = false, arguments = {})
@channel = channel || raise(ArgumentError, "channel is nil")
View
4 lib/bunny/exchange.rb
@@ -40,7 +40,8 @@ class Exchange
# a routing key of "weather.usa.ca.sandiego" and there is a queue Q with this name,
# that message will be routed to Q.
#
- # @param [Bunny::Channel] channel Channel to use.
+ # @param [Bunny::Channel] channel_or_connection Channel to use. {Bunny::Session} instances
+ # are only supported for backwards compatibility.
#
# @example Publishing a messages to the tasks queue
# channel = Bunny::Channel.new(connection)
@@ -142,7 +143,6 @@ def publish(payload, opts = {})
# Deletes the exchange unless it is a default exchange
#
- # @param [String] name Exchange name
# @param [Hash] opts Options
#
# @option opts [Boolean] if_unused (false) Should this exchange be deleted only if it is no longer used
View
18 lib/bunny/queue.rb
@@ -217,18 +217,18 @@ def subscribe_with(consumer, opts = {:block => false})
# @api public
#
# @example
- # conn = Bunny.new
- # conn.start
+ # conn = Bunny.new
+ # conn.start
#
- # ch = conn.create_channel
- # q = ch.queue("test1")
- # x = ch.default_exchange
- # x.publish("Hello, everybody!", :routing_key => 'test1')
+ # ch = conn.create_channel
+ # q = ch.queue("test1")
+ # x = ch.default_exchange
+ # x.publish("Hello, everybody!", :routing_key => 'test1')
#
- # delivery_info, properties, payload = q.pop
+ # delivery_info, properties, payload = q.pop
#
- # puts "This is the message: " + payload + "\n\n"
- # conn.close
+ # puts "This is the message: " + payload + "\n\n"
+ # conn.close
def pop(opts = {:ack => false}, &block)
delivery_info, properties, content = @channel.basic_get(@name, opts)

0 comments on commit c1b2956

Please sign in to comment.