mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
- 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:
parent
7bf5d5a042
commit
06b8788f58
1 changed files with 8 additions and 1 deletions
|
@ -28,6 +28,9 @@ class LogStash::Inputs::Amqp < LogStash::Inputs::Base
|
||||||
|
|
||||||
# The name of the exchange
|
# The name of the exchange
|
||||||
config :name, :validate => :string, :required => true
|
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
|
# The routing key to bind to
|
||||||
config :key, :validate => :string
|
config :key, :validate => :string
|
||||||
|
@ -79,6 +82,10 @@ class LogStash::Inputs::Amqp < LogStash::Inputs::Base
|
||||||
@amqpurl += "#{@user}:xxxxxx@"
|
@amqpurl += "#{@user}:xxxxxx@"
|
||||||
end
|
end
|
||||||
@amqpurl += "#{@host}:#{@port}#{@vhost}/#{@name}"
|
@amqpurl += "#{@host}:#{@port}#{@vhost}/#{@name}"
|
||||||
|
|
||||||
|
if @queue_name.nil?
|
||||||
|
@queue_name = @name
|
||||||
|
end
|
||||||
end # def register
|
end # def register
|
||||||
|
|
||||||
def run(queue)
|
def run(queue)
|
||||||
|
@ -88,7 +95,7 @@ class LogStash::Inputs::Amqp < LogStash::Inputs::Base
|
||||||
return if terminating?
|
return if terminating?
|
||||||
@bunny.start
|
@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)
|
exchange = @bunny.exchange(@name, :type => @exchange_type.to_sym, :durable => @durable)
|
||||||
@queue.bind(exchange, :key => @key)
|
@queue.bind(exchange, :key => @key)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue