fourkites-sqspoller 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjNkMWYyZjUyZjNmMTgwZjllMGJkZGFkMWM5Y2NlMTkxNmFjM2YzNg==
4
+ OWZlOWI3Y2UzNTg3MWJiYTkwNDU4MzlmYzVjNGRlNDFmYmE2ZTc3Mw==
5
5
  data.tar.gz: !binary |-
6
- ZDdiMGI2NDkwZWI4Y2EzZTg5NWIzZGRjNmE3ZTUwNGUyODNkMTQ1Zg==
6
+ YTZmNDkyMmQ2NWYzNzAyMTdjYTY5MDQxYzlkNzMzZDcxNjk0NmE1OQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjNjMjdjOTQ5OWE1NGI3ZDAyMjllODM3MzgwNTdjMWFjNzRhOWUzMzUwMjhl
10
- ZDVhNjcyZGMzMjYzMThlMDNlOTk5MGM2ZjljNTk2N2JiZmVhN2IwNmZkZWU3
11
- MDAwYTAzMTA1YjEwZDkyZWQxOGIzNjMxYmNiNDM1NGVjZjdjMjk=
9
+ YzQwYzEzYjg3OTE5ZjBlZWJmODU2OTczZmM3ZjhmYTI3MzVlZDZmZDg5NWUw
10
+ MDY4YzVmNDQ4OGQ0MzQ3NTY1ODJkMzI3MDM4NWNjODEyMTdmNGI0NmFjZmFh
11
+ YTY3NWI2OWVlMTZkYjZiODI3YzcxNjYyNmQyYzFlNjliODdlODU=
12
12
  data.tar.gz: !binary |-
13
- NWQyZDkyZTAxOGFhNmVmZGRhYjMxZTc1NGM2ZWNiNDY3NGFiZmJhOGUzMGUz
14
- MGU0ZDVhNzcwMjUwMmFiMzM1ZmUyNGU1ZWE4NmU2NTIwM2RkNzZjMGNiOGI4
15
- ODc4ODUwNmE3Y2I1NTAyYzAzYzI4MWQ0ZmE3Mjk5Y2U3MWM3YzQ=
13
+ MTFmNGEzMGZjOTRhYmQ2Yzg3NmFjYzFlM2Q2ZGY1ZWZkMDUwZmJiYzQxOTZm
14
+ ZGMyMjE1OWY4NTM0NmRiYTQ4MTBhMWNhYjNiYmRkYmU4Y2ZlYWJjNjNjOWU1
15
+ NDNlYWZmZDNkMjhjN2U2NWFlOWYwZDg5YzI1NTBiMjk1NTg1OTM=
@@ -5,8 +5,8 @@ require "net/http"
5
5
  module Sqspoller
6
6
  class MessageDelegator
7
7
 
8
- def initialize(worker_thread_pool_size, waiting_tasks_ratio, worker_task)
9
- @logger = Logger.new(STDOUT)
8
+ def initialize(worker_thread_pool_size, waiting_tasks_ratio, worker_task, logger_file)
9
+ @logger = Logger.new(logger_file)
10
10
  @worker_thread_pool_size = worker_thread_pool_size
11
11
  @max_allowed_queue_size = waiting_tasks_ratio * worker_thread_pool_size
12
12
  @semaphore = Mutex.new
@@ -6,8 +6,8 @@ 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)
10
- @logger = Logger.new(STDOUT)
9
+ def initialize(queue_name, polling_threads_count, task_delegator, access_key_id, secret_access_key, region, logger_file)
10
+ @logger = Logger.new(logger_file)
11
11
  @queue_name = queue_name
12
12
  @polling_threads_count = polling_threads_count
13
13
  @sqs = Aws::SQS::Client.new(:access_key_id => access_key_id, :secret_access_key => secret_access_key, :region => region)
@@ -48,10 +48,10 @@ module Sqspoller
48
48
  queues_config.keys.each { |queue|
49
49
  total_poller_threads += queues_config[queue][:polling_threads]
50
50
  }
51
- message_delegator = initialize_worker config[:worker_configuration], total_poller_threads
51
+ message_delegator = initialize_worker config[:worker_configuration], total_poller_threads, logger_file
52
52
  queues_config.keys.each { |queue|
53
53
  @logger.info "Creating QueueController object for queue: #{queue}"
54
- qc = QueueController.new queue, queues_config[queue][:polling_threads], message_delegator, access_key_id, secret_access_key, region
54
+ qc = QueueController.new queue, queues_config[queue][:polling_threads], message_delegator, access_key_id, secret_access_key, region, logger_file
55
55
  qcs << qc
56
56
  }
57
57
 
@@ -80,15 +80,15 @@ module Sqspoller
80
80
  end
81
81
  end
82
82
 
83
- def initialize_worker(worker_configuration, total_poller_threads)
83
+ def initialize_worker(worker_configuration, total_poller_threads, logger_file)
84
84
  worker_thread_count = worker_configuration[:concurrency]
85
- worker_task = worker_configuration[:worker_class].split('::').inject(Object) {|o,c| o.const_get c}.new(worker_configuration)
85
+ worker_task = worker_configuration[:worker_class].split('::').inject(Object) {|o,c| o.const_get c}.new(worker_configuration, logger_file)
86
86
  waiting_tasks_ratio = worker_configuration[:waiting_tasks_ratio]
87
87
  waiting_tasks_ratio = 1 if waiting_tasks_ratio.nil?
88
88
  if worker_thread_count.nil?
89
- message_delegator = MessageDelegator.new total_poller_threads, waiting_tasks_ratio, worker_task
89
+ message_delegator = MessageDelegator.new total_poller_threads, waiting_tasks_ratio, worker_task, logger_file
90
90
  else
91
- message_delegator = MessageDelegator.new worker_thread_count, waiting_tasks_ratio, worker_task
91
+ message_delegator = MessageDelegator.new worker_thread_count, waiting_tasks_ratio, worker_task, logger_file
92
92
  end
93
93
  return message_delegator
94
94
  end
@@ -7,8 +7,8 @@ module Sqspoller
7
7
 
8
8
  class WorkerTask
9
9
 
10
- def initialize(worker_configuration)
11
- @logger = Logger.new(STDOUT)
10
+ def initialize(worker_configuration, logger_file)
11
+ @logger = Logger.new(logger_file)
12
12
  @http_method = worker_configuration[:http_method]
13
13
  @http_url = worker_configuration[:http_url]
14
14
  @uri = URI(@http_url)
data/sqspoller.gemspec CHANGED
@@ -5,7 +5,7 @@ require 'sqspoller/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "fourkites-sqspoller"
8
- spec.version = '0.1.10'
8
+ spec.version = '0.1.11'
9
9
  spec.authors = ["anshul-fk"]
10
10
  spec.email = ["anshul@fourkites.com"]
11
11
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fourkites-sqspoller
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - anshul-fk