proletariat 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -17
- data/circle.yml +3 -0
- data/lib/proletariat/version.rb +1 -1
- data/proletariat.gemspec +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9b75a11540c8940f8256bb4bd0df5ac94815d55
|
4
|
+
data.tar.gz: 209de755237d7a66393ae496641433e2d4acefe1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffa580c3f1fc35cb53e4b564be9c91a1e57614d65d9542b1e799d844f84e7e0eb69096665e1977151d3eea200987128c10b543b57083158946c88780efab0fb4
|
7
|
+
data.tar.gz: 75a1c07abdae088f8d430c8525a3f155a4bf061a9a0bcc11991672009a8238cd238803f0250c8e9734669dcd0754542b3a59df1d7dce5df689ed8a0fa65fa16f
|
data/README.md
CHANGED
@@ -4,18 +4,11 @@ Lightweight background processing in Ruby powered by RabbitMQ and the excellent
|
|
4
4
|
|
5
5
|
[![Code Climate](https://codeclimate.com/github/SebastianEdwards/proletariat.png)](https://codeclimate.com/github/SebastianEdwards/proletariat)
|
6
6
|
|
7
|
-
### Warning!
|
8
|
-
|
9
|
-
This software is early-alpha, may contain bugs and change considerably in the near future.
|
10
|
-
|
11
|
-
For production use I recommend the better supported and more fully-featured [Sneakers gem](https://github.com/jondot/sneakers).
|
12
|
-
|
13
7
|
## Installation
|
14
8
|
|
15
|
-
Add
|
9
|
+
Add this line to your application's `Gemfile`:
|
16
10
|
|
17
11
|
gem 'proletariat'
|
18
|
-
gem 'concurrent-ruby', github: 'ruby-concurrency/concurrent-ruby'
|
19
12
|
|
20
13
|
And run:
|
21
14
|
|
@@ -33,21 +26,21 @@ If you aren't using default RabbitMQ connection settings, ensure the `RABBITMQ_U
|
|
33
26
|
|
34
27
|
Your worker classes should inherit from `Proletariat::Worker` and implement the `#work` method.
|
35
28
|
|
36
|
-
Proletariat works exclusively on RabbitMQ Topic exchanges
|
29
|
+
Proletariat works exclusively on RabbitMQ Topic exchanges. Routing keys can be bound via a call to `.listen_on`. This can be called multiple times to bind to multiple keys. Topic wildcards `*` and `#` may both be used.
|
37
30
|
|
38
31
|
The `#work` method should return `:ok` on success or `:drop` / `:requeue` on failure.
|
39
32
|
|
40
33
|
Here's a complete example:
|
41
34
|
|
42
35
|
class SendUserIntroductoryEmail < Proletariat::Worker
|
43
|
-
listen_on 'user
|
36
|
+
listen_on 'user.*.user_created'
|
44
37
|
|
45
38
|
def work(message, key, headers)
|
46
39
|
params = JSON.parse(message)
|
47
40
|
|
48
41
|
UserMailer.introductory_email(params).deliver!
|
49
42
|
|
50
|
-
publish '
|
43
|
+
publish "user.#{params['id']}.introductory_email_sent", {id: params['id']}.to_json
|
51
44
|
|
52
45
|
:ok
|
53
46
|
end
|
@@ -67,11 +60,11 @@ Run the rake command.
|
|
67
60
|
|
68
61
|
It's not recommended to run your background workers in the same process as your main web process. Heroku will shutdown idle `web` processes, killing your background workers in the process. Instead create a new process type for Proletariat by adding the following to your Procfile:
|
69
62
|
|
70
|
-
|
63
|
+
worker: bundle exec rake proletariat:run
|
71
64
|
|
72
65
|
And run:
|
73
66
|
|
74
|
-
heroku ps:scale
|
67
|
+
heroku ps:scale worker=1
|
75
68
|
|
76
69
|
### Testing with Cucumber
|
77
70
|
|
@@ -98,7 +91,3 @@ Use the provided helpers in your step definitions to synchronize your test suite
|
|
98
91
|
#### Why build another RabbitMQ background worker library?
|
99
92
|
|
100
93
|
I wanted a library which shared one RabbitMQ connection across all of the workers on a given process. Many hosted RabbitMQ platforms tightly limit the max number of connections.
|
101
|
-
|
102
|
-
## TODO
|
103
|
-
- Add command line interface
|
104
|
-
- Abstract retry strategies
|
data/circle.yml
ADDED
data/lib/proletariat/version.rb
CHANGED
data/proletariat.gemspec
CHANGED
@@ -19,6 +19,6 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.add_development_dependency 'rspec', '3.1.0'
|
20
20
|
s.add_development_dependency 'rubocop'
|
21
21
|
|
22
|
-
s.add_runtime_dependency 'concurrent-ruby', '~> 0.7'
|
22
|
+
s.add_runtime_dependency 'concurrent-ruby', '~> 0.7.1'
|
23
23
|
s.add_runtime_dependency 'bunny', '~> 1.6.3'
|
24
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: proletariat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Edwards
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 0.7.1
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 0.7.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bunny
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,6 +81,7 @@ files:
|
|
81
81
|
- LICENSE
|
82
82
|
- README.md
|
83
83
|
- Rakefile
|
84
|
+
- circle.yml
|
84
85
|
- lib/proletariat.rb
|
85
86
|
- lib/proletariat/concerns/logging.rb
|
86
87
|
- lib/proletariat/concurrency/actor.rb
|
@@ -132,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
133
|
version: '0'
|
133
134
|
requirements: []
|
134
135
|
rubyforge_project:
|
135
|
-
rubygems_version: 2.4.
|
136
|
+
rubygems_version: 2.4.5
|
136
137
|
signing_key:
|
137
138
|
specification_version: 4
|
138
139
|
summary: Lightweight background processing powered by RabbitMQ
|