delayed_job_ironmq 0.1.3 → 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.
- data/README.md +31 -11
- data/VERSION +1 -1
- data/lib/delayed/backend/worker.rb +14 -17
- metadata +14 -14
data/README.md
CHANGED
@@ -4,10 +4,14 @@ This is [IronMQ](http://www.iron.io/products/mq) backend for [delayed_job](http:
|
|
4
4
|
|
5
5
|
## Get credentials
|
6
6
|
|
7
|
-
|
7
|
+
Heroku users: Simply add the IronMQ add-on and you can skip the rest of this section. It will be setup
|
8
|
+
automatically when you add the IronMQ add-on.
|
9
|
+
|
10
|
+
To start using delayed_job_ironmq, you need to sign up for Iron.io and setup your credentials.
|
8
11
|
|
9
12
|
1. Go to http://iron.io/ and sign up.
|
10
13
|
2. Get an Oauth Token at http://hud.iron.io/tokens
|
14
|
+
3. Add an iron.json file or setup environment variables for authentication. See http://dev.iron.io/articles/configuration/ for details.
|
11
15
|
|
12
16
|
## Installation
|
13
17
|
|
@@ -18,20 +22,16 @@ gem 'delayed_job'
|
|
18
22
|
gem 'delayed_job_ironmq'
|
19
23
|
```
|
20
24
|
|
21
|
-
|
25
|
+
Optionally: Add an initializer (`config/initializers/delayed_job.rb`):
|
22
26
|
|
23
27
|
```ruby
|
24
28
|
Delayed::Worker.configure do |config|
|
25
|
-
config.token = 'XXXXXXXXXXXXXXXX'
|
26
|
-
config.project_id = 'XXXXXXXXXXXXXXXX'
|
27
|
-
|
28
29
|
# optional params:
|
29
30
|
config.available_priorities = [-1,0,1,2] # Default is [0]. Please note, each new priority will speed down a bit picking job from queue
|
30
31
|
config.queue_name = 'default' # Specify an alternative queue name
|
31
32
|
config.delay = 0 # Time to wait before message will be available on the queue
|
32
33
|
config.timeout = 5.minutes # The time in seconds to wait after message is taken off the queue, before it is put back on. Delete before :timeout to ensure it does not go back on the queue.
|
33
34
|
config.expires_in = 7.days # After this time, message will be automatically removed from the queue.
|
34
|
-
end
|
35
35
|
end
|
36
36
|
```
|
37
37
|
|
@@ -42,18 +42,38 @@ That's it. Use [delayed_job as normal](http://github.com/collectiveidea/delayed_
|
|
42
42
|
Example:
|
43
43
|
|
44
44
|
```ruby
|
45
|
-
class
|
46
|
-
def
|
47
|
-
puts
|
45
|
+
class User
|
46
|
+
def background_stuff
|
47
|
+
puts "I run in the background"
|
48
48
|
end
|
49
49
|
end
|
50
|
-
|
50
|
+
```
|
51
51
|
|
52
|
+
Then in one of your controllers:
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
user = User.new
|
56
|
+
user.delay.bg_stuff
|
52
57
|
```
|
53
58
|
|
59
|
+
## Start worker process
|
60
|
+
|
61
|
+
rake jobs:work
|
62
|
+
|
63
|
+
That will start pulling jobs off the queue and processing them.
|
64
|
+
|
65
|
+
# Demo Rails Application
|
66
|
+
|
67
|
+
Here's a demo rails app you can clone and try it out: https://github.com/treeder/delayed_job_with_iron_mq
|
68
|
+
|
69
|
+
# Using with Heroku
|
70
|
+
|
71
|
+
To use with Heroku, just add the [IronMQ Add-on](https://addons.heroku.com/iron_mq) and
|
72
|
+
you're good to go.
|
73
|
+
|
54
74
|
# Documentation
|
55
75
|
|
56
76
|
You can find more documentation here:
|
57
77
|
|
58
78
|
* http://iron.io
|
59
|
-
* http://dev.iron.io
|
79
|
+
* http://dev.iron.io
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
@@ -8,24 +8,16 @@ module Delayed
|
|
8
8
|
|
9
9
|
def configure
|
10
10
|
yield(config)
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
)
|
16
|
-
self.queue_name = config.queue_name || 'default'
|
17
|
-
self.delay = config.delay || 0
|
18
|
-
self.timeout = config.timeout || 5.minutes
|
19
|
-
self.expires_in = config.expires_in || 7.days
|
11
|
+
self.queue_name = config.queue_name || 'default'
|
12
|
+
self.delay = config.delay || 0
|
13
|
+
self.timeout = config.timeout || 5.minutes
|
14
|
+
self.expires_in = config.expires_in || 7.days
|
20
15
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
else
|
25
|
-
raise ArgumentError, "available_priorities option has wrong format. Please provide array of Integer values, includes zero. Default is [0]."
|
26
|
-
end
|
16
|
+
priorities = config.available_priorities || [0]
|
17
|
+
if priorities.include?(0) && priorities.all? { |p| p.is_a?(Integer) }
|
18
|
+
self.available_priorities = priorities.sort
|
27
19
|
else
|
28
|
-
raise ArgumentError, "
|
20
|
+
raise ArgumentError, "available_priorities option has wrong format. Please provide array of Integer values, includes zero. Default is [0]."
|
29
21
|
end
|
30
22
|
end
|
31
23
|
|
@@ -35,4 +27,9 @@ module Delayed
|
|
35
27
|
|
36
28
|
end
|
37
29
|
end
|
38
|
-
end
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
Delayed::Worker.ironmq = IronMQ::Client.new()
|
34
|
+
# initialize with defaults
|
35
|
+
Delayed::Worker.configure {}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: delayed_job_ironmq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-08-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: iron_mq
|
17
|
-
requirement: &
|
17
|
+
requirement: &70165371264220 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 1.4.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70165371264220
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: delayed_job
|
28
|
-
requirement: &
|
28
|
+
requirement: &70165371263400 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: 3.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70165371263400
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: rspec
|
39
|
-
requirement: &
|
39
|
+
requirement: &70165371262740 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,18 +44,18 @@ dependencies:
|
|
44
44
|
version: '2.0'
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70165371262740
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
|
-
name:
|
50
|
-
requirement: &
|
49
|
+
name: jeweler2
|
50
|
+
requirement: &70165371262240 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - ! '>='
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
55
|
+
version: '0'
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *70165371262240
|
59
59
|
description: IronMQ backend for delayed_job
|
60
60
|
email: info@iron.io
|
61
61
|
executables: []
|
@@ -89,7 +89,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
89
|
version: '0'
|
90
90
|
segments:
|
91
91
|
- 0
|
92
|
-
hash:
|
92
|
+
hash: 2357096919605816309
|
93
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|