aws-activejob-sqs 0.1.0 → 0.1.2

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
  SHA256:
3
- metadata.gz: 0d637830be5b747a64bf196605511e325d998d43bdd378ce9377a04c4cd0d217
4
- data.tar.gz: 3dd1d9a0385451965ef4e4efc9f51c73a9bdc5e896d4a2a9cd65c862319aac8b
3
+ metadata.gz: affc2da5d1e7982fa347d088e7a9e26f657da450be383543f6f9368e915640b1
4
+ data.tar.gz: 5552185182c07bf3f121673bc3608ca3f4a023f769f0cf2a8c3d7f3248df653b
5
5
  SHA512:
6
- metadata.gz: edeeb1caccc5479f6a70bffada55cce0d7a15e70088a3a9f381782be366cf8200e0a16b03291be78c551a54b18192268b32b85f8626b6f0a23cf1b2392cd7da7
7
- data.tar.gz: 945cce4e13a9ccf35d5f2521da551dc53dc349bdb1667a20ad7ad7c8d509b97d7892761a418152afafad3656ebdecdfc2d8bee0f1922be54a72d40ea4703218f
6
+ metadata.gz: bf5bcb68796d6c1f3ecbeaea4fcc2b04e11aa8806a77e1a5c0e430b5d60cbb207d6130e9b8a8fa5ec3a3dcf412eb3df0610e238e6fb7a51644e44de90f5edc2c
7
+ data.tar.gz: 54d480693b52d54eb14d1708676e9fd726ffd74c3e2e8b9b587424b5bdb3a27156f9bb9c2fccfa7dc0b24411d2ee9637128ebdd893c35ecd1443472cf1854de7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ Unreleased Changes
2
+ ------------------
3
+
4
+ 0.1.1 (2024-12-02)
5
+ ------------------
6
+ * Issue - Add `aws_sqs_active_job` executable to facilitate migration to 1.0.
7
+
8
+ 0.1.1 (2024-12-23)
9
+ ------------------
10
+
11
+ * Feature - Add lifecycle hooks for Executor.
12
+
1
13
  0.1.0 (2024-11-16)
2
14
  ------------------
3
15
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.2
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require_relative '../lib/aws/active_job/sqs/poller'
5
+
6
+ require 'rails'
7
+ require File.expand_path('config/environment.rb')
8
+
9
+ Aws::ActiveJob::SQS::Poller.new(ARGV).run
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
+ Kernel.warn "The `aws_sqs_active_job` executable is renamed to `aws_active_job_sqs` in 1.0.0"
5
+
4
6
  require_relative '../lib/aws/active_job/sqs/poller'
5
7
 
6
8
  require 'rails'
@@ -15,6 +15,20 @@ module Aws
15
15
  fallback_policy: :abort # Concurrent::RejectedExecutionError must be handled
16
16
  }.freeze
17
17
 
18
+ class << self
19
+ def on_stop(&block)
20
+ lifecycle_hooks[:stop] << block
21
+ end
22
+
23
+ def lifecycle_hooks
24
+ @lifecycle_hooks ||= Hash.new { |h, k| h[k] = [] }
25
+ end
26
+
27
+ def clear_hooks
28
+ @lifecycle_hooks = nil
29
+ end
30
+ end
31
+
18
32
  def initialize(options = {})
19
33
  @executor = Concurrent::ThreadPoolExecutor.new(DEFAULTS.merge(options))
20
34
  @retry_standard_errors = options[:retry_standard_errors]
@@ -32,6 +46,7 @@ module Aws
32
46
  end
33
47
 
34
48
  def shutdown(timeout = nil)
49
+ run_hooks_for(:stop)
35
50
  @executor.shutdown
36
51
  clean_shutdown = @executor.wait_for_termination(timeout)
37
52
  if clean_shutdown
@@ -71,6 +86,12 @@ module Aws
71
86
  @task_complete.set
72
87
  end
73
88
  end
89
+
90
+ def run_hooks_for(event_name)
91
+ return unless (hooks = self.class.lifecycle_hooks[event_name])
92
+
93
+ hooks.each(&:call)
94
+ end
74
95
  end
75
96
  end
76
97
  end
@@ -29,6 +29,10 @@ module Aws
29
29
  def self.fifo?(queue_url)
30
30
  queue_url.end_with?('.fifo')
31
31
  end
32
+
33
+ def self.on_worker_stop(...)
34
+ Executor.on_stop(...)
35
+ end
32
36
  end
33
37
  end
34
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-activejob-sqs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amazon Web Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-16 00:00:00.000000000 Z
11
+ date: 2024-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-sqs
@@ -63,12 +63,14 @@ email:
63
63
  - aws-dr-rubygems@amazon.com
64
64
  executables:
65
65
  - aws_sqs_active_job
66
+ - aws_active_job_sqs
66
67
  extensions: []
67
68
  extra_rdoc_files: []
68
69
  files:
69
70
  - CHANGELOG.md
70
71
  - LICENSE
71
72
  - VERSION
73
+ - bin/aws_active_job_sqs
72
74
  - bin/aws_sqs_active_job
73
75
  - lib/active_job/queue_adapters/sqs_adapter.rb
74
76
  - lib/active_job/queue_adapters/sqs_adapter/params.rb
@@ -99,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
101
  - !ruby/object:Gem::Version
100
102
  version: '0'
101
103
  requirements: []
102
- rubygems_version: 3.5.11
104
+ rubygems_version: 3.5.9
103
105
  signing_key:
104
106
  specification_version: 4
105
107
  summary: ActiveJob integration with SQS