logstash-input-jsqs 0.9.1-java → 0.9.2-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85191dce09f154911ff8d1a2b5d076472bf275c6
4
- data.tar.gz: 6bac1f35c24c0f04b87072a1e3d359ab742f1e45
3
+ metadata.gz: c7035e8063acc3862a7b7289f94cff69691ec567
4
+ data.tar.gz: b9fe883cf27a4d52f0e829c41dfbba59d96c0508
5
5
  SHA512:
6
- metadata.gz: 86639ab9e5ee0bd507d407ac76d5d0e98eb8ceb299ddb39a0ab442f41d2423173cbca96e44b132855537fac0fdb57abc953472b64513d7a6a1e7af544042cf79
7
- data.tar.gz: 52b578a50de497436eaaa8a708a9d8230942290c7fef80414bbc82a832660795b77a64231da2469d9efac9857c31d4cf8f9a056e7c96390d34dbe981b37464dc
6
+ metadata.gz: c1d08cca6ac2023c98d47c5af70b698ba5aa3c9992b8cfd1cbd12661b9b38ccf0ed0905ad552eeccff32f31c498f686f2c89cf24e6f5edb275d2084aef219ea2
7
+ data.tar.gz: e66f13d7a80cd27f50bbf8796e8f705b5ad702e25ee41f0116fdd9d2db1f8ed47a708372f4c8e5a1b3d1df886a7d20c954700902a93e569e3b441c1c0c6f1a4c
@@ -1,20 +1,9 @@
1
1
  # encoding: utf-8
2
+ # Original plugin by Al Belsky (https://logstash.jira.com/browse/LOGSTASH-1968)
3
+
2
4
  require "logstash/inputs/threadable"
3
- require "logstash/namespace"
4
- require "logstash/plugin_mixins/aws_config"
5
- require "digest/sha2"
6
5
  require 'logstash-input-jsqs_jars.rb'
7
6
 
8
- # aws-java-sdk dependencies
9
- # require 'jar/aws-java-sdk.jar'
10
- # require 'jar/httpclient-4.2.jar'
11
- # require 'jar/httpcore-4.2.jar'
12
- # require 'jar/commons-codec-1.6'
13
- # require 'jar/jackson-core-2.1.1.jar'
14
- # require 'jar/jackson-databind-2.1.1.jar'
15
- # require 'jar/jackson-annotations-2.1.1.jar'
16
- #
17
-
18
7
  # Pull events from an Amazon Web Services Simple Queue Service (SQS) queue.
19
8
  #
20
9
  # SQS is a simple, scalable queue system that is part of the
@@ -68,14 +57,6 @@ require 'logstash-input-jsqs_jars.rb'
68
57
  # See http://aws.amazon.com/iam/ for more details on setting up AWS identities.
69
58
  #
70
59
 
71
- # -------------------------------------
72
- # NOTICE:
73
- # This is a custom SQS input that uses the Java AWS SDK (Ruby SDK didn't scale beyond 200 messages per second).
74
- # This plugin assumes that the logstash distribution contains the Java AWS SDK its required dependencies.
75
- # In Logstash 1.3.3, Apache HTTP client (4.1) had to be removed from the Logstash distribution,
76
- # as it was incompatible with the Apache HTTP client 4.2 version used by the Java AWS SDK.
77
- # -------------------------------------
78
-
79
60
  class LogStash::Inputs::JSQS < LogStash::Inputs::Threadable
80
61
 
81
62
  config_name "jsqs"
@@ -89,35 +70,30 @@ class LogStash::Inputs::JSQS < LogStash::Inputs::Threadable
89
70
  config :max_inflight_receive_batches, :validate => :number, :default => 50
90
71
  config :max_done_receive_batches, :validate => :number, :default => 50
91
72
  config :max_number_of_messages, :validate => :number, :default => 10
73
+ config :retry_count, :validate => :number, :default => 5
92
74
 
93
75
  @receiveRequest
94
76
 
95
77
  public
96
78
  def register
97
-
98
79
  @logger.info("Registering SQS input", :queue => @queue)
99
80
 
100
- begin
101
- # Client config
102
- @logger.debug("Creating AWS SQS queue client", :queue => @queue)
103
- clientConfig = ClientConfiguration.new.withMaxConnections(@max_connections)
104
- # SQS client
105
- @sqs = AmazonSQSAsyncClient.new(clientConfig)
106
- @logger.debug("Amazon SQS Client created")
107
-
108
- # Buffered client config
109
- queueBufferConfig = QueueBufferConfig.new.withMaxBatchOpenMs(@max_batch_open_ms).withMaxInflightReceiveBatches(@max_inflight_receive_batches).withMaxDoneReceiveBatches(@max_done_receive_batches)
110
-
111
- @bufferedSqs = AmazonSQSBufferedAsyncClient.new(@sqs, queueBufferConfig);
112
- @logger.info("Connected to AWS SQS queue successfully.", :queue => @queue)
113
-
114
- @receiveRequest = ReceiveMessageRequest.new(@queueUrl).withMaxNumberOfMessages(@max_number_of_messages)
115
-
116
- rescue Exception => e
117
- @logger.error("Unable to access SQS queue.", :error => e.to_s, :queue => @queue)
118
- throw e
119
- end # begin/rescue
120
-
81
+ # Client config
82
+ @logger.debug("Creating AWS SQS queue client", :queue => @queue)
83
+ clientConfig = ClientConfiguration.new.withMaxConnections(@max_connections)
84
+
85
+ # SQS client
86
+ @sqs = AmazonSQSAsyncClient.new(clientConfig)
87
+ @logger.debug("Amazon SQS Client created")
88
+
89
+ # Buffered client config
90
+ queueBufferConfig = QueueBufferConfig.new.withMaxBatchOpenMs(@max_batch_open_ms).withMaxInflightReceiveBatches(@max_inflight_receive_batches).withMaxDoneReceiveBatches(@max_done_receive_batches)
91
+
92
+ @bufferedSqs = AmazonSQSBufferedAsyncClient.new(@sqs, queueBufferConfig);
93
+ @logger.info("Connected to AWS SQS queue successfully.", :queue => @queue)
94
+
95
+ @receiveRequest = ReceiveMessageRequest.new(@queueUrl).withMaxNumberOfMessages(@max_number_of_messages)
96
+
121
97
  end # def register
122
98
 
123
99
  public
@@ -125,6 +101,7 @@ class LogStash::Inputs::JSQS < LogStash::Inputs::Threadable
125
101
  @logger.debug("Polling SQS queue", :queue => @queue)
126
102
 
127
103
  while running?
104
+ begin
128
105
  result = @bufferedSqs.receiveMessage(@receiveRequest)
129
106
  deleteEntries = []
130
107
  # Process messages (expected 0 - 10 messages)
@@ -143,7 +120,16 @@ class LogStash::Inputs::JSQS < LogStash::Inputs::Threadable
143
120
  # Issue delete request
144
121
  @bufferedSqs.deleteMessageBatch(deleteRequest);
145
122
  end # end if
146
-
123
+ rescue Exception => e
124
+ if (@retry_count -= 1) > 0
125
+ @logger.warn("Unable to access SQS queue. Sleeping before retrying.", :error => e.to_s, :queue => @queue)
126
+ sleep(10)
127
+ retry
128
+ else
129
+ @logger.error("Unable to access SQS queue. Aborting.", :error => e.to_s, :queue => @queue)
130
+ teardown
131
+ end # if
132
+ end # begin
147
133
  end # polling loop
148
134
  end # def run
149
135
 
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.platform = RUBY_PLATFORM
3
3
  s.name = 'logstash-input-jsqs'
4
- s.version = '0.9.1'
4
+ s.version = '0.9.2'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "SQS input plugin using the AWS Java SDK"
7
7
  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 logstash-input-jsqs. This gem is not a stand-alone program"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-jsqs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: java
6
6
  authors:
7
7
  - Jamie Cressey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-04 00:00:00.000000000 Z
11
+ date: 2015-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -62,14 +62,9 @@ files:
62
62
  - logstash-input-jsqs.gemspec
63
63
  - spec/inputs/example_spec.rb
64
64
  - vendor/jar-dependencies/runtime-jars/aws-java-sdk-1.7.13.jar
65
- - vendor/jar-dependencies/runtime-jars/commons-codec-1.9.jar
66
65
  - vendor/jar-dependencies/runtime-jars/commons-logging-1.2.jar
67
- - vendor/jar-dependencies/runtime-jars/httpclient-4.4.jar
66
+ - vendor/jar-dependencies/runtime-jars/httpclient-4.4.1.jar
68
67
  - vendor/jar-dependencies/runtime-jars/httpcore-4.4.1.jar
69
- - vendor/jar-dependencies/runtime-jars/jackson-annotations-2.5.1.jar
70
- - vendor/jar-dependencies/runtime-jars/jackson-core-2.5.1.jar
71
- - vendor/jar-dependencies/runtime-jars/jackson-databind-2.5.1.jar
72
- - vendor/jar-dependencies/runtime-jars/joda-time-2.7.jar
73
68
  homepage:
74
69
  licenses:
75
70
  - Apache License (2.0)