- Add queue_name support to amqp input so you can specify the name of

the queue separately. The previous behavior is still the default -
  that the queue name is the same as the exchange name.
  LOGSTASH-148
This commit is contained in:
Jordan Sissel 2011-08-20 23:16:33 -07:00
parent 7bf5d5a042
commit 06b8788f58

View file

@ -28,6 +28,9 @@ class LogStash::Inputs::Amqp < LogStash::Inputs::Base
# The name of the exchange
config :name, :validate => :string, :required => true
# The name of the queue. If not set, defaults to the same name as the exchange.
config :queue_name, :validate => :string
# The routing key to bind to
config :key, :validate => :string
@ -79,6 +82,10 @@ class LogStash::Inputs::Amqp < LogStash::Inputs::Base
@amqpurl += "#{@user}:xxxxxx@"
end
@amqpurl += "#{@host}:#{@port}#{@vhost}/#{@name}"
if @queue_name.nil?
@queue_name = @name
end
end # def register
def run(queue)
@ -88,7 +95,7 @@ class LogStash::Inputs::Amqp < LogStash::Inputs::Base
return if terminating?
@bunny.start
@queue = @bunny.queue(@name, :durable => @durable)
@queue = @bunny.queue(@queue_name, :durable => @durable)
exchange = @bunny.exchange(@name, :type => @exchange_type.to_sym, :durable => @durable)
@queue.bind(exchange, :key => @key)