logstash-input-rabbitmq 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/CHANGELOG.md +5 -0
 - data/lib/logstash/inputs/rabbitmq.rb +6 -2
 - data/logstash-input-rabbitmq.gemspec +2 -2
 - data/spec/inputs/rabbitmq_spec.rb +32 -14
 - metadata +4 -4
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 234eccd39f2d2459784e232bfee4aca303c51956
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 8ff9cd86fbd139dd7a3623316f1b60749a9bfe57
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 8e7947a49fc82d0066c9d0563b2dd9ca16d5780ffec7bca130b58a5e1776c3ca7bfaf18528ca1e3f4982ae794f0636e0d029d7e330d6ec9e207bd3117813518a
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: efb6b29abfdd37f47cf9ea707789561ab5848f2c00e1e59dc66958802527ef793d871b264cc4d9f86b7757f4c96b1243e14bfd4c7017aa346e2fcd222b3589d3
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,3 +1,8 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ## 3.3.0
         
     | 
| 
      
 2 
     | 
    
         
            +
             - Fix a regression in 3.2.0 that reinstated behavior that duplicated consumers
         
     | 
| 
      
 3 
     | 
    
         
            +
             - Always declare exchanges used, the exchange now need not exist before LS starts
         
     | 
| 
      
 4 
     | 
    
         
            +
             - Allow a precise specification of the exchange type
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
       1 
6 
     | 
    
         
             
            ## 3.2.0
         
     | 
| 
       2 
7 
     | 
    
         
             
             - The properties and headers of the messages are now saved in the [@metadata][rabbitmq_headers] and [@metadata][rabbitmq_properties] fields.
         
     | 
| 
       3 
8 
     | 
    
         
             
             - Logstash now shuts down if the server sends a basic.cancel method.
         
     | 
| 
         @@ -1,6 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # encoding: utf-8
         
     | 
| 
       2 
2 
     | 
    
         
             
            require 'logstash/plugin_mixins/rabbitmq_connection'
         
     | 
| 
       3 
3 
     | 
    
         
             
            require 'logstash/inputs/threadable'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'logstash/event'
         
     | 
| 
       4 
5 
     | 
    
         | 
| 
       5 
6 
     | 
    
         
             
            module LogStash
         
     | 
| 
       6 
7 
     | 
    
         
             
              module Inputs
         
     | 
| 
         @@ -142,6 +143,9 @@ module LogStash 
     | 
|
| 
       142 
143 
     | 
    
         
             
                  # The name of the exchange to bind the queue to.
         
     | 
| 
       143 
144 
     | 
    
         
             
                  config :exchange, :validate => :string
         
     | 
| 
       144 
145 
     | 
    
         | 
| 
      
 146 
     | 
    
         
            +
                  # The type of the exchange to bind to
         
     | 
| 
      
 147 
     | 
    
         
            +
                  config :exchange_type, :validate => :string
         
     | 
| 
      
 148 
     | 
    
         
            +
             
     | 
| 
       145 
149 
     | 
    
         
             
                  # The routing key to use when binding a queue to the exchange.
         
     | 
| 
       146 
150 
     | 
    
         
             
                  # This is only relevant for direct or topic exchanges.
         
     | 
| 
       147 
151 
     | 
    
         
             
                  #
         
     | 
| 
         @@ -174,6 +178,7 @@ module LogStash 
     | 
|
| 
       174 
178 
     | 
    
         | 
| 
       175 
179 
     | 
    
         
             
                  def bind_exchange!
         
     | 
| 
       176 
180 
     | 
    
         
             
                    if @exchange
         
     | 
| 
      
 181 
     | 
    
         
            +
                      @hare_info.exchange = declare_exchange!(@hare_info.channel, @exchange, @exchange_type, @durable)
         
     | 
| 
       177 
182 
     | 
    
         
             
                      @hare_info.queue.bind(@exchange, :routing_key => @key)
         
     | 
| 
       178 
183 
     | 
    
         
             
                    end
         
     | 
| 
       179 
184 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -199,8 +204,7 @@ module LogStash 
     | 
|
| 
       199 
204 
     | 
    
         
             
                    # that we rely on MarchHare to do the reconnection for us with auto_reconnect.
         
     | 
| 
       200 
205 
     | 
    
         
             
                    # Unfortunately, while MarchHare does the reconnection work it won't re-subscribe the consumer
         
     | 
| 
       201 
206 
     | 
    
         
             
                    # hence the logic below.
         
     | 
| 
       202 
     | 
    
         
            -
                    @consumer = @hare_info.queue.build_consumer(: 
     | 
| 
       203 
     | 
    
         
            -
                                                                :on_cancellation => Proc.new { on_cancellation }) do |metadata, data|
         
     | 
| 
      
 207 
     | 
    
         
            +
                    @consumer = @hare_info.queue.build_consumer(:on_cancellation => Proc.new { on_cancellation }) do |metadata, data|
         
     | 
| 
       204 
208 
     | 
    
         
             
                      @codec.decode(data) do |event|
         
     | 
| 
       205 
209 
     | 
    
         
             
                        decorate(event)
         
     | 
| 
       206 
210 
     | 
    
         
             
                        event["@metadata"]["rabbitmq_headers"] = get_headers(metadata)
         
     | 
| 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       2 
2 
     | 
    
         
             
              s.name            = 'logstash-input-rabbitmq'
         
     | 
| 
       3 
     | 
    
         
            -
              s.version         = '3. 
     | 
| 
      
 3 
     | 
    
         
            +
              s.version         = '3.3.0'
         
     | 
| 
       4 
4 
     | 
    
         
             
              s.licenses        = ['Apache License (2.0)']
         
     | 
| 
       5 
5 
     | 
    
         
             
              s.summary         = "Pull events from a RabbitMQ exchange."
         
     | 
| 
       6 
6 
     | 
    
         
             
              s.description     = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
         
     | 
| 
         @@ -19,7 +19,7 @@ Gem::Specification.new do |s| 
     | 
|
| 
       19 
19 
     | 
    
         
             
              s.metadata = { "logstash_plugin" => "true", "logstash_group" => "input" }
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
              # Gem dependencies
         
     | 
| 
       22 
     | 
    
         
            -
              s.add_runtime_dependency "logstash-core", ">= 2.0.0 
     | 
| 
      
 22 
     | 
    
         
            +
              s.add_runtime_dependency "logstash-core", ">= 2.0.0", "< 3.0.0"
         
     | 
| 
       23 
23 
     | 
    
         
             
              s.add_runtime_dependency "logstash-mixin-rabbitmq_connection", '>= 2.3.0', '< 3.0.0'
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
25 
     | 
    
         
             
              s.add_runtime_dependency 'logstash-codec-json'
         
     | 
| 
         @@ -2,6 +2,7 @@ 
     | 
|
| 
       2 
2 
     | 
    
         
             
            require "logstash/devutils/rspec/spec_helper"
         
     | 
| 
       3 
3 
     | 
    
         
             
            require "logstash/inputs/rabbitmq"
         
     | 
| 
       4 
4 
     | 
    
         
             
            require "thread"
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'logstash/event'
         
     | 
| 
       5 
6 
     | 
    
         | 
| 
       6 
7 
     | 
    
         
             
            Thread.abort_on_exception = true
         
     | 
| 
       7 
8 
     | 
    
         | 
| 
         @@ -72,9 +73,22 @@ describe LogStash::Inputs::RabbitMQ do 
     | 
|
| 
       72 
73 
     | 
    
         
             
                    let(:key) { "routing key" }
         
     | 
| 
       73 
74 
     | 
    
         
             
                    let(:rabbitmq_settings) { super.merge("exchange" => exchange, "key" => key) }
         
     | 
| 
       74 
75 
     | 
    
         | 
| 
       75 
     | 
    
         
            -
                     
     | 
| 
       76 
     | 
    
         
            -
                      instance. 
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
      
 76 
     | 
    
         
            +
                    before do
         
     | 
| 
      
 77 
     | 
    
         
            +
                      allow(instance).to receive(:declare_exchange!)
         
     | 
| 
      
 78 
     | 
    
         
            +
                    end
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
                    context "on register" do
         
     | 
| 
      
 81 
     | 
    
         
            +
                      before do
         
     | 
| 
      
 82 
     | 
    
         
            +
                        instance.register
         
     | 
| 
      
 83 
     | 
    
         
            +
                      end
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
                      it "should bind to the exchange" do
         
     | 
| 
      
 86 
     | 
    
         
            +
                        expect(queue).to have_received(:bind).with(exchange, :routing_key => key)
         
     | 
| 
      
 87 
     | 
    
         
            +
                      end
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
                      it "should declare the exchange" do
         
     | 
| 
      
 90 
     | 
    
         
            +
                        expect(instance).to have_received(:declare_exchange!)
         
     | 
| 
      
 91 
     | 
    
         
            +
                      end
         
     | 
| 
       78 
92 
     | 
    
         
             
                    end
         
     | 
| 
       79 
93 
     | 
    
         | 
| 
       80 
94 
     | 
    
         
             
                    context "but not immediately available" do
         
     | 
| 
         @@ -165,15 +179,21 @@ describe "with a live server", :integration => true do 
     | 
|
| 
       165 
179 
     | 
    
         
             
                expect(instance.instance_variable_get(:@hare_info).channel.prefetch).to eql(256)
         
     | 
| 
       166 
180 
     | 
    
         
             
              end
         
     | 
| 
       167 
181 
     | 
    
         | 
| 
       168 
     | 
    
         
            -
              describe "receiving a message with a queue specified" do
         
     | 
| 
       169 
     | 
    
         
            -
                let(:config) { super.merge("queue" => queue_name) }
         
     | 
| 
      
 182 
     | 
    
         
            +
              describe "receiving a message with a queue + exchange specified" do
         
     | 
| 
      
 183 
     | 
    
         
            +
                let(:config) { super.merge("queue" => queue_name, "exchange" => exchange_name, "exchange_type" => "fanout") }
         
     | 
| 
       170 
184 
     | 
    
         
             
                let(:event) { output_queue.pop }
         
     | 
| 
       171 
     | 
    
         
            -
                let(: 
     | 
| 
      
 185 
     | 
    
         
            +
                let(:exchange) { test_channel.exchange(exchange_name, :type => "fanout") }
         
     | 
| 
      
 186 
     | 
    
         
            +
                let(:exchange_name) { "logstash-input-rabbitmq-#{rand(0xFFFFFFFF)}" }
         
     | 
| 
      
 187 
     | 
    
         
            +
                #let(:queue) { test_channel.queue(queue_name, :auto_delete => true) }
         
     | 
| 
       172 
188 
     | 
    
         
             
                let(:queue_name) { "logstash-input-rabbitmq-#{rand(0xFFFFFFFF)}" }
         
     | 
| 
       173 
189 
     | 
    
         | 
| 
      
 190 
     | 
    
         
            +
                after do
         
     | 
| 
      
 191 
     | 
    
         
            +
                  exchange.delete
         
     | 
| 
      
 192 
     | 
    
         
            +
                end
         
     | 
| 
      
 193 
     | 
    
         
            +
             
     | 
| 
       174 
194 
     | 
    
         
             
                context "when the message has a payload but no message headers" do
         
     | 
| 
       175 
195 
     | 
    
         
             
                  before do
         
     | 
| 
       176 
     | 
    
         
            -
                     
     | 
| 
      
 196 
     | 
    
         
            +
                    exchange.publish(message)
         
     | 
| 
       177 
197 
     | 
    
         
             
                  end
         
     | 
| 
       178 
198 
     | 
    
         | 
| 
       179 
199 
     | 
    
         
             
                  let(:message) { "Foo Message" }
         
     | 
| 
         @@ -193,7 +213,7 @@ describe "with a live server", :integration => true do 
     | 
|
| 
       193 
213 
     | 
    
         
             
                  before do
         
     | 
| 
       194 
214 
     | 
    
         
             
                    # Don't test every single property but select a few with
         
     | 
| 
       195 
215 
     | 
    
         
             
                    # different characteristics to get sufficient coverage.
         
     | 
| 
       196 
     | 
    
         
            -
                     
     | 
| 
      
 216 
     | 
    
         
            +
                    exchange.publish("",
         
     | 
| 
       197 
217 
     | 
    
         
             
                                  :properties => {
         
     | 
| 
       198 
218 
     | 
    
         
             
                                    :app_id    => app_id,
         
     | 
| 
       199 
219 
     | 
    
         
             
                                    :timestamp => Java::JavaUtil::Date.new(epoch * 1000),
         
     | 
| 
         @@ -215,16 +235,16 @@ describe "with a live server", :integration => true do 
     | 
|
| 
       215 
235 
     | 
    
         
             
                    props = event["@metadata"]["rabbitmq_properties"]
         
     | 
| 
       216 
236 
     | 
    
         
             
                    expect(props["app-id"]).to eq(app_id)
         
     | 
| 
       217 
237 
     | 
    
         
             
                    expect(props["delivery-mode"]).to eq(1)
         
     | 
| 
       218 
     | 
    
         
            -
                    expect(props["exchange"]).to eq( 
     | 
| 
      
 238 
     | 
    
         
            +
                    expect(props["exchange"]).to eq(exchange_name)
         
     | 
| 
       219 
239 
     | 
    
         
             
                    expect(props["priority"]).to eq(priority)
         
     | 
| 
       220 
     | 
    
         
            -
                    expect(props["routing-key"]).to eq( 
     | 
| 
      
 240 
     | 
    
         
            +
                    expect(props["routing-key"]).to eq("")
         
     | 
| 
       221 
241 
     | 
    
         
             
                    expect(props["timestamp"]).to eq(epoch)
         
     | 
| 
       222 
242 
     | 
    
         
             
                  end
         
     | 
| 
       223 
243 
     | 
    
         
             
                end
         
     | 
| 
       224 
244 
     | 
    
         | 
| 
       225 
245 
     | 
    
         
             
                context "when message headers are available" do
         
     | 
| 
       226 
246 
     | 
    
         
             
                  before do
         
     | 
| 
       227 
     | 
    
         
            -
                     
     | 
| 
      
 247 
     | 
    
         
            +
                    exchange.publish("", :properties => { :headers => headers })
         
     | 
| 
       228 
248 
     | 
    
         
             
                  end
         
     | 
| 
       229 
249 
     | 
    
         | 
| 
       230 
250 
     | 
    
         
             
                  let (:headers) {
         
     | 
| 
         @@ -245,8 +265,6 @@ describe "with a live server", :integration => true do 
     | 
|
| 
       245 
265 
     | 
    
         
             
              end
         
     | 
| 
       246 
266 
     | 
    
         | 
| 
       247 
267 
     | 
    
         
             
              describe LogStash::Inputs::RabbitMQ do
         
     | 
| 
       248 
     | 
    
         
            -
                it_behaves_like "an interruptible input plugin" 
     | 
| 
       249 
     | 
    
         
            -
             
     | 
| 
       250 
     | 
    
         
            -
                end
         
     | 
| 
      
 268 
     | 
    
         
            +
                it_behaves_like "an interruptible input plugin"
         
     | 
| 
       251 
269 
     | 
    
         
             
              end
         
     | 
| 
       252 
270 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: logstash-input-rabbitmq
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 3. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 3.3.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Elastic
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2016-03- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-03-11 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: logstash-core
         
     | 
| 
         @@ -16,7 +16,7 @@ dependencies: 
     | 
|
| 
       16 
16 
     | 
    
         
             
                requirements:
         
     | 
| 
       17 
17 
     | 
    
         
             
                - - '>='
         
     | 
| 
       18 
18 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       19 
     | 
    
         
            -
                    version: 2.0.0 
     | 
| 
      
 19 
     | 
    
         
            +
                    version: 2.0.0
         
     | 
| 
       20 
20 
     | 
    
         
             
                - - <
         
     | 
| 
       21 
21 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       22 
22 
     | 
    
         
             
                    version: 3.0.0
         
     | 
| 
         @@ -24,7 +24,7 @@ dependencies: 
     | 
|
| 
       24 
24 
     | 
    
         
             
                requirements:
         
     | 
| 
       25 
25 
     | 
    
         
             
                - - '>='
         
     | 
| 
       26 
26 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       27 
     | 
    
         
            -
                    version: 2.0.0 
     | 
| 
      
 27 
     | 
    
         
            +
                    version: 2.0.0
         
     | 
| 
       28 
28 
     | 
    
         
             
                - - <
         
     | 
| 
       29 
29 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       30 
30 
     | 
    
         
             
                    version: 3.0.0
         
     |