sidekiq_sqs_processor 0.1.2 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a20dc1ecd4771415945cbfa13409b8a532c3ce16fbd8e5a67d2d85dcc0c65cb5
4
- data.tar.gz: 9593831edbcb55c0c0b6d7b625e2c8c536fa90105c6bb084e6cf0f27d2c98d01
3
+ metadata.gz: 8310e2c63e60bbdbf3b298b50283f03c2e1b0e89870fac72896c7d69ac534002
4
+ data.tar.gz: b715e081c0b7a03234e71eb7e90a06a2fc6b85dc9037c377e5ec22d8f56f05f4
5
5
  SHA512:
6
- metadata.gz: 99c6d8311c5a273edae3727d989d6684487986278fc74e252d093fbb4c95ab6c890c71862cbde65bb90652e4c77e0b2c1e938f0296ae8381b028f85e37392033
7
- data.tar.gz: 112ee1e6d29af7c2e4c1b40ff0fc864fbd169d388c7e04de2d287112da7b63960b4cd9fc98c9337264cc0c22993ceb070b61ff52c8ba1c4dccb86f2c2415d55d
6
+ metadata.gz: 6ed1c722a4d49ddb1927047b4c727b0345ce2b38cc0d4d191047bfc23aca6e7096e4cb148c164a7b342245798d7318c46f29e1efd2736a81041944421743737d
7
+ data.tar.gz: c1670e93bedc5111cf2f641fb0a8262de4db2d7100aff68307d19ba0bac55dbd25d040304596f32cfb0ec6edfa3ccf0f1272dc0e513629071ec9b7666ac605da
@@ -44,12 +44,18 @@ module SidekiqSqsProcessor
44
44
  @queue_workers.keys
45
45
  end
46
46
 
47
+ def register_worker(queue_url, worker_class)
48
+ @queue_workers[queue_url] = worker_class
49
+ puts "[SidekiqSqsProcessor] Registered worker #{worker_class} for queue #{queue_url}"
50
+ end
51
+
47
52
  def worker_class_for_queue(queue_url)
48
- if worker = @queue_workers[queue_url]
49
- puts "[SidekiqSqsProcessor] Found worker #{worker} for queue #{queue_url}"
50
- else
53
+ worker = @queue_workers[queue_url]
54
+
55
+ if worker.nil?
51
56
  puts "[SidekiqSqsProcessor] No worker found for queue #{queue_url}"
52
57
  end
58
+
53
59
  worker
54
60
  end
55
61
  end
@@ -22,6 +22,25 @@ module SidekiqSqsProcessor
22
22
  @mutex.synchronize do
23
23
  puts "[SidekiqSqsProcessor] Inside start mutex"
24
24
  begin
25
+ # Validate configuration before starting
26
+ unless SidekiqSqsProcessor.configuration.ready_for_polling?
27
+ puts "[SidekiqSqsProcessor] WARNING: Configuration not ready for polling. Skipping poller start."
28
+ puts "[SidekiqSqsProcessor] Queue workers: #{SidekiqSqsProcessor.configuration.queue_workers.inspect}"
29
+ return false
30
+ end
31
+
32
+ # Validate AWS credentials
33
+ begin
34
+ SidekiqSqsProcessor.sqs_client.get_queue_attributes(
35
+ queue_url: SidekiqSqsProcessor.configuration.queue_urls.first,
36
+ attribute_names: ["QueueArn"]
37
+ )
38
+ rescue Aws::SQS::Errors::ServiceError => e
39
+ puts "[SidekiqSqsProcessor] WARNING: AWS credentials validation failed: #{e.class} - #{e.message}"
40
+ puts "[SidekiqSqsProcessor] Skipping poller start due to AWS configuration issues"
41
+ return false
42
+ end
43
+
25
44
  @running = true
26
45
  start_polling_threads
27
46
  puts "[SidekiqSqsProcessor] Polling threads started successfully"
@@ -82,7 +101,7 @@ module SidekiqSqsProcessor
82
101
  end
83
102
 
84
103
  def poll_queue(queue_url)
85
- begin
104
+ begin
86
105
  response = receive_messages(queue_url)
87
106
  process_messages(response.messages, queue_url)
88
107
  rescue StandardError => e
@@ -42,8 +42,11 @@ module SidekiqSqsProcessor
42
42
  30.times do |i|
43
43
  if SidekiqSqsProcessor.configuration.ready_for_polling?
44
44
  puts "[SidekiqSqsProcessor] Configuration is ready, starting poller..."
45
- SidekiqSqsProcessor.start_continuous_poller
46
- puts "[SidekiqSqsProcessor] Poller started successfully"
45
+ if SidekiqSqsProcessor.start_continuous_poller
46
+ puts "[SidekiqSqsProcessor] Poller started successfully"
47
+ else
48
+ puts "[SidekiqSqsProcessor] WARNING: Poller failed to start but Sidekiq will continue running"
49
+ end
47
50
  break
48
51
  else
49
52
  puts "[SidekiqSqsProcessor] Waiting for configuration to be ready... (#{i+1}/30)" if i % 5 == 0
@@ -57,10 +60,13 @@ module SidekiqSqsProcessor
57
60
  puts "[SidekiqSqsProcessor] WARNING: SQS polling will not start"
58
61
  puts "[SidekiqSqsProcessor] WARNING: Current configuration state:"
59
62
  puts "[SidekiqSqsProcessor] Queue workers: #{SidekiqSqsProcessor.configuration.queue_workers.inspect}"
63
+ puts "[SidekiqSqsProcessor] AWS Region: #{SidekiqSqsProcessor.configuration.aws_region}"
64
+ puts "[SidekiqSqsProcessor] Sidekiq will continue running without SQS polling"
60
65
  end
61
66
  rescue => e
62
67
  puts "[SidekiqSqsProcessor] ERROR: Failed to start poller: #{e.class} - #{e.message}"
63
68
  puts "[SidekiqSqsProcessor] ERROR: Backtrace: #{e.backtrace.join("\n")}"
69
+ puts "[SidekiqSqsProcessor] WARNING: Sidekiq will continue running without SQS polling"
64
70
  # Log the error but don't crash the thread
65
71
  end
66
72
  end
@@ -1,5 +1,4 @@
1
-
2
1
  module SidekiqSqsProcessor
3
- VERSION = "0.1.2"
2
+ VERSION = "0.1.4"
4
3
  end
5
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq_sqs_processor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Unnikrishnan KP