shoryuken-later 0.0.5.2 → 0.0.5.3

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
- MGNlYzJmMTg4NTJlNDIwNTA5YjQwZjZmYjZlZTRkMTkyMzVmMGNiYQ==
4
+ ZGU2ZmZlMzE1Y2U3YjE5ZWFlMzlkNmY1NzkwYzE3OTU4MmY3Y2Y5Zg==
5
5
  data.tar.gz: !binary |-
6
- NDczOWYzNmM5ZjAyY2ZjYWRiNTdjMTA3M2ZmZTFmODYzYTU1NDQ4Ng==
6
+ OWU1NjQwOTY5M2E4ZTQwNWM3OTBjOWJiMjFmMjdiZGQ4ZTlkZTJjNg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZjE0NDQwZDZhZWViMzhkYThmZTY1YjY2MDY4MDMyZTZkY2QyZmM0MDIzOTky
10
- ZDI4ZDg0YjhiYWE4NDY4YTNmZDgwYWY2YzZjOWVjM2E3ZTg5ZTQxZjljNzM4
11
- Y2JkNTVmZDZhNDNlMTc1YTEwMGJmNzE5YjBhOGNmNWUzZThjNWY=
9
+ YjEzZGMwNzcwYjY4NzE4NGJmN2E3NTc4YmNhZTFlZWRjNWJjNDg0MmIwYmM5
10
+ MzRkYzk0NDhhNzgzY2Q2YTM0N2Y2ZTk3YWY1ODc0YWFmYmYxMmQ3ZjdlOWU1
11
+ NzlmZWQwMWIyZTQ5MWE1ZWU5ZDM1ODhiZjcyNDU2YmIzZGJjZDE=
12
12
  data.tar.gz: !binary |-
13
- YjlhOTE1ZWZjYTAxYjljNjJkMDZhMDkzNjk2N2EwN2VkODU5ZmUwNDkxNjUx
14
- NWFmMzI3Y2JkY2UyNDA0MWEwYzMyNDE2OGM0ZTcxMjU5NDdiOTkwODkyOTc5
15
- ZjhmODZiMTlkYzU2YWY4MTIwNDJlYWYyYjQ0MGMwMmI5OGU1N2I=
13
+ NjExYzQ0YWI1YjYyOWFiMmE5ZjdiNzRkZTZhZmM3Nzk0ZDEzZGNjYzk1OWVi
14
+ MjYzNGYzMTExMTZhMzAzYzJlMGZlZWE5MGMwOTlmNzk1M2U2YzgzMWQwNDM0
15
+ ZmVkNGU2NzIwOTRlZGMyMzNjZjhjZjYwNzdlZDU5ZjVjYzE2NTE=
data/README.md CHANGED
@@ -1,27 +1,10 @@
1
1
  # shoryuken-later
2
2
 
3
3
  A scheduling plugin for [Shoryuken](https://github.com/phstc/shoryuken) that uses [Dynamo DB](https://aws.amazon.com/dynamodb/)
4
- to schedule messages arbitrarily far into the future.
4
+ to delay messages arbitrarily far into the future.
5
5
 
6
6
  ## Features
7
7
 
8
- ### Integration with Shoryuken::Worker
9
-
10
- A new method named `perform_later` is added to `Shoryuken::Worker` allowing messages to be delayed arbitrarily far into the future. If the delay is 15 minutes or less, then the message is enqueued into the specified SQS `:queue` as usual. Otherwise, the message is inserted into the specified DynamoDB `:schedule_table`.
11
-
12
- ```ruby
13
- require 'shoryuken-later'
14
-
15
- class MyWorker
16
- include Shoryuken::Worker
17
-
18
- shoryuken_options queue: 'default', schedule_table: 'default_schedule'
19
- end
20
-
21
- # Schedules a message to be processed 30 minutes from now.
22
- MyWorker.perform_later(Time.now + 30 * 60, 'Foobar')
23
- ```
24
-
25
8
  ### One or more schedule tables
26
9
 
27
10
  Supports polling one or more DynamoDB tables for messages.
@@ -38,11 +21,12 @@ later:
38
21
  You can use the same configuration file for both `Shoryuken` and `Shoryuken::Later`, because the new configuration options are namespaced.
39
22
 
40
23
  ```yaml
41
- # This key is used by both Shoryuken and Shoryuken::Later
24
+ # These keys are used by both Shoryuken and Shoryuken::Later
42
25
  aws:
43
26
  access_key_id: ... # or <%= ENV['AWS_ACCESS_KEY_ID'] %>
44
27
  secret_access_key: ... # or <%= ENV['AWS_SECRET_ACCESS_KEY'] %>
45
28
  region: us-east-1 # or <%= ENV['AWS_REGION'] %>
29
+ logfile: some/path/to/file.log
46
30
 
47
31
  # This key is only used by Shoryuken::Later
48
32
  later:
@@ -50,9 +34,6 @@ later:
50
34
  pidfile: some/path/to/file.pid
51
35
  tables:
52
36
  - table1
53
-
54
- # These keys are used by both Shoryuken and Shoryuken::Later
55
- logfile: some/path/to/file.log
56
37
 
57
38
  # These keys are only used by Shoryuken
58
39
  concurrency: 3
@@ -60,4 +41,83 @@ delay: 0
60
41
  queues:
61
42
  - [queue1, 1]
62
43
  - [queue2, 2]
63
- ```
44
+ ```
45
+
46
+ ## Usage
47
+
48
+ ### Integration with ActiveJob
49
+
50
+ A custom ActiveJob adapter can used to support delaying messages arbitrarily far into the future.
51
+
52
+ ```ruby
53
+ # config/application.rb
54
+ config.active_job.queue_adapter = :shoryuken_later
55
+ ```
56
+
57
+ When you use the `:shoryuken_later` queue adapter, jobs to be performed farther than 15 minutes into the future (by setting the `wait` or `wait_until` ActiveJob options), will be inserted into the *default* schedule table. You can set the default schedule table in an initializer.
58
+
59
+ ```ruby
60
+ # config/initializers/shoryuken_later.rb
61
+ Shoryuken::Later.default_table = "#{Rails.env}_myapp_later"
62
+ ```
63
+
64
+
65
+ ### Integration with Shoryuken::Worker
66
+
67
+ A new method named `perform_later` is added to `Shoryuken::Worker` allowing messages to be delayed arbitrarily far into the future. If the delay is 15 minutes or less, then the message is enqueued into the specified SQS `:queue` as usual. Otherwise, the message is inserted into the specified DynamoDB `:schedule_table`.
68
+
69
+ ```ruby
70
+ require 'shoryuken-later'
71
+
72
+ class MyWorker
73
+ include Shoryuken::Worker
74
+
75
+ shoryuken_options queue: 'default', schedule_table: 'default_schedule'
76
+ end
77
+
78
+ # Schedules a message to be processed 30 minutes from now.
79
+ MyWorker.perform_later(Time.now + 30 * 60, 'Foobar')
80
+ ```
81
+
82
+
83
+ ## Requirements
84
+
85
+ Ruby 2.0 or greater. Ruby 1.9 is no longer supported.
86
+
87
+ ## Installation
88
+
89
+ Add this line to your application's Gemfile:
90
+
91
+ ```ruby
92
+ gem 'shoryuken-later'
93
+ ```
94
+
95
+ Or to get the latest updates:
96
+
97
+ ```ruby
98
+ gem 'shoryuken-later', github: 'joekhoobyar/shoryuken-later', branch: 'master'
99
+ ```
100
+
101
+ And then execute:
102
+
103
+ $ bundle
104
+
105
+ Or install it yourself as:
106
+
107
+ $ gem install shoryuken-later
108
+
109
+ ## Documentation
110
+
111
+ Learn about using Shoryuken at the [Shoryuken Wiki](https://github.com/phstc/shoryuken/wiki).
112
+
113
+ ## Credits
114
+
115
+ [Pablo Cantero](https://github.com/phstc), creator of [Shoryuken](https://github.com/phstc/shoryuken), and [everybody who contributed to it](https://github.com/phstc/shoryuken/graphs/contributors). I borrowed a lot of code from Shoryuken itself as a shortcut to making this gem.
116
+
117
+ ## Contributing
118
+
119
+ 1. Fork it ( https://github.com/joekhoobyar/shoryuken-later/fork )
120
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
121
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
122
+ 4. Push to the branch (`git push origin my-new-feature`)
123
+ 5. Create a new Pull Request
@@ -79,6 +79,7 @@ module Shoryuken
79
79
  ::Rails::Application.initializer "shoryuken-later.eager_load" do
80
80
  ::Rails.application.config.eager_load = true
81
81
  end
82
+ require 'shoryuken/later/active_job_adapter' if defined?(::ActiveJob)
82
83
  require File.expand_path("config/environment.rb")
83
84
  end
84
85
 
@@ -215,10 +216,10 @@ module Shoryuken
215
216
 
216
217
  config = options[:config_file] ? parse_config(options[:config_file]).deep_symbolize_keys : {}
217
218
 
218
- Shoryuken::Later.options[:later].merge!(config.delete(:later))
219
+ Shoryuken::Later.options[:later].merge!(config.delete(:later) || {})
219
220
  Shoryuken::Later.options.merge!(config)
220
221
 
221
- Shoryuken::Later.options[:later].merge!(options.delete(:later))
222
+ Shoryuken::Later.options[:later].merge!(options.delete(:later) || {})
222
223
  Shoryuken::Later.options.merge!(options)
223
224
 
224
225
  # Tables from command line options take precedence...
@@ -1,5 +1,5 @@
1
1
  module Shoryuken
2
2
  module Later
3
- VERSION = '0.0.5.2'
3
+ VERSION = '0.0.5.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shoryuken-later
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5.2
4
+ version: 0.0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Khoobyar