Skip to content

Commit

Permalink
API reference docs
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
Michael Klishin committed Jan 21, 2013
1 parent 6eaf308 commit c1b2956
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion lib/bunny/channel.rb
Expand Up @@ -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 # @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) # (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 [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 Bunny::Channel#prefetch
# @see http://rubybunny.info/articles/queues.html Queues and Consumers guide # @see http://rubybunny.info/articles/queues.html Queues and Consumers guide
# @api public # @api public
Expand Down
8 changes: 6 additions & 2 deletions lib/bunny/consumer.rb
Expand Up @@ -22,10 +22,14 @@ class Consumer
attr_reader :exclusive attr_reader :exclusive




#
# @param [Bunny::Channel] channel Channel this consumer will use # @param [Bunny::Channel] channel Channel this consumer will use
# @param [Bunny::Queue,String] queue Queue messages will be consumed from # @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 # @api public
def initialize(channel, queue, consumer_tag = channel.generate_consumer_tag, no_ack = true, exclusive = false, arguments = {}) def initialize(channel, queue, consumer_tag = channel.generate_consumer_tag, no_ack = true, exclusive = false, arguments = {})
@channel = channel || raise(ArgumentError, "channel is nil") @channel = channel || raise(ArgumentError, "channel is nil")
Expand Down
4 changes: 2 additions & 2 deletions lib/bunny/exchange.rb
Expand Up @@ -40,7 +40,8 @@ class Exchange
# a routing key of "weather.usa.ca.sandiego" and there is a queue Q with this name, # a routing key of "weather.usa.ca.sandiego" and there is a queue Q with this name,
# that message will be routed to Q. # 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 # @example Publishing a messages to the tasks queue
# channel = Bunny::Channel.new(connection) # channel = Bunny::Channel.new(connection)
Expand Down Expand Up @@ -142,7 +143,6 @@ def publish(payload, opts = {})


# Deletes the exchange unless it is a default exchange # Deletes the exchange unless it is a default exchange
# #
# @param [String] name Exchange name
# @param [Hash] opts Options # @param [Hash] opts Options
# #
# @option opts [Boolean] if_unused (false) Should this exchange be deleted only if it is no longer used # @option opts [Boolean] if_unused (false) Should this exchange be deleted only if it is no longer used
Expand Down
18 changes: 9 additions & 9 deletions lib/bunny/queue.rb
Expand Up @@ -217,18 +217,18 @@ def subscribe_with(consumer, opts = {:block => false})
# @api public # @api public
# #
# @example # @example
# conn = Bunny.new # conn = Bunny.new
# conn.start # conn.start
# #
# ch = conn.create_channel # ch = conn.create_channel
# q = ch.queue("test1") # q = ch.queue("test1")
# x = ch.default_exchange # x = ch.default_exchange
# x.publish("Hello, everybody!", :routing_key => 'test1') # 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" # puts "This is the message: " + payload + "\n\n"
# conn.close # conn.close
def pop(opts = {:ack => false}, &block) def pop(opts = {:ack => false}, &block)
delivery_info, properties, content = @channel.basic_get(@name, opts) delivery_info, properties, content = @channel.basic_get(@name, opts)


Expand Down

0 comments on commit c1b2956

Please sign in to comment.