fourkites-sqspoller 0.1.12.28 → 0.1.12.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sqspoller/queue_controller.rb +3 -2
- data/lib/sqspoller/sqs_poller.rb +9 -1
- data/sqspoller.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d2475d071855bf200d86cf3b63dd63f7c636f0a
|
4
|
+
data.tar.gz: 39a1cce9356e148e9a23bd18c1bd5ba9dff46864
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09fa32cd44f0351c43ffa68d7461484568471ee8776a12df1469bc3508d7ca6858c120351c599d63cfc61ca09f56ba124ce38ab896d4a051741b795356858279'
|
7
|
+
data.tar.gz: f78845897551ccf3d841bb2a46667b850e9f84a79dc202feae138e94d35c3ddee92907cd15454ce8c9f062facf0aabeb3c56f1e935644d7dbec9bcd42ebab366
|
@@ -6,10 +6,11 @@ require "aws-sdk"
|
|
6
6
|
module Sqspoller
|
7
7
|
class QueueController
|
8
8
|
|
9
|
-
def initialize(queue_name, polling_threads_count, task_delegator, access_key_id, secret_access_key, region, logger_file)
|
9
|
+
def initialize(queue_name, polling_threads_count, wait_time_seconds, task_delegator, access_key_id, secret_access_key, region, logger_file)
|
10
10
|
@logger = Logger.new(logger_file)
|
11
11
|
@queue_name = queue_name
|
12
12
|
@polling_threads_count = polling_threads_count
|
13
|
+
@wait_time_seconds = wait_time_seconds
|
13
14
|
@sqs = Aws::SQS::Client.new(:access_key_id => access_key_id, :secret_access_key => secret_access_key, :region => region)
|
14
15
|
@queue_details = @sqs.get_queue_url(queue_name: queue_name)
|
15
16
|
@threads = []
|
@@ -36,7 +37,7 @@ module Sqspoller
|
|
36
37
|
while true
|
37
38
|
@logger.info "Polling queue #{@queue_name} for messages"
|
38
39
|
begin
|
39
|
-
msgs = @sqs.receive_message :queue_url => queue_url
|
40
|
+
msgs = @sqs.receive_message :queue_url => queue_url, :wait_time_seconds => @wait_time_seconds
|
40
41
|
rescue Exception => e
|
41
42
|
@logger.info "Error receiving messages from queue #{@queue_name}: #{e.message}"
|
42
43
|
next
|
data/lib/sqspoller/sqs_poller.rb
CHANGED
@@ -55,7 +55,7 @@ module Sqspoller
|
|
55
55
|
next
|
56
56
|
end
|
57
57
|
@logger.info "Creating QueueController object for queue: #{queue}"
|
58
|
-
qc = QueueController.new queue, queues_config[queue][:polling_threads], message_delegator, access_key_id, secret_access_key, region, logger_file
|
58
|
+
qc = QueueController.new queue, queues_config[queue][:polling_threads], get_wait_time_seconds(queues_config[queue][:wait_time_seconds]), message_delegator, access_key_id, secret_access_key, region, logger_file
|
59
59
|
qcs << qc
|
60
60
|
}
|
61
61
|
|
@@ -66,6 +66,14 @@ module Sqspoller
|
|
66
66
|
qcs.each{ |qc| qc.threads.each { |thread| thread.join } }
|
67
67
|
end
|
68
68
|
|
69
|
+
def get_wait_time_seconds(wait_time_seconds)
|
70
|
+
default_wait_time_seconds = 20
|
71
|
+
if wait_time_seconds && wait_time_seconds >=0 && wait_time_seconds <=20
|
72
|
+
return wait_time_seconds
|
73
|
+
end
|
74
|
+
default_wait_time_seconds
|
75
|
+
end
|
76
|
+
|
69
77
|
def start_poller(filename, queue_config_name, access_key_id, secret_access_key, region, log_filename=nil)
|
70
78
|
puts "Starting poller"
|
71
79
|
config = YAML.load(ERB.new(IO.read(filename)).result)
|
data/sqspoller.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fourkites-sqspoller
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.12.
|
4
|
+
version: 0.1.12.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- anshul-fk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
124
|
rubyforge_project:
|
125
|
-
rubygems_version: 2.
|
125
|
+
rubygems_version: 2.5.2.3
|
126
126
|
signing_key:
|
127
127
|
specification_version: 4
|
128
128
|
summary: Gem to poll messages from SQS queue and process them
|