queueing_rabbit 0.1.3 → 0.2.0
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/lib/queueing_rabbit/client/amqp.rb +46 -40
- data/lib/queueing_rabbit/client/bunny.rb +20 -23
- data/lib/queueing_rabbit/extensions/direct_exchange.rb +26 -0
- data/lib/queueing_rabbit/extensions/new_relic.rb +19 -4
- data/lib/queueing_rabbit/extensions/retryable.rb +22 -0
- data/lib/queueing_rabbit/job.rb +56 -11
- data/lib/queueing_rabbit/jobs/abstract_job.rb +27 -0
- data/lib/queueing_rabbit/jobs/json_job.rb +19 -0
- data/lib/queueing_rabbit/version.rb +1 -1
- data/lib/queueing_rabbit/worker.rb +14 -4
- data/lib/queueing_rabbit.rb +21 -6
- data/queueing_rabbit.gemspec +6 -17
- data/spec/integration/asynchronous_publishing_and_consuming_spec.rb +36 -16
- data/spec/integration/asynchronous_publishing_and_consuming_with_retries_spec.rb +103 -0
- data/spec/integration/direct_exchange_asynchronous_publishing_and_consuming_spec.rb +93 -0
- data/spec/integration/jobs/print_line_job.rb +5 -11
- data/spec/integration/json_job_asynchronous_publishing_and_consuming_spec.rb +99 -0
- data/spec/integration/persistent_asynchronous_publishing_and_consuming_spec.rb +96 -0
- data/spec/integration/synchronous_publishing_and_asynchronous_consuming_spec.rb +13 -17
- data/spec/integration/synchronous_publishing_spec.rb +6 -2
- data/spec/spec_helper.rb +4 -1
- data/spec/unit/queueing_rabbit/client/amqp_spec.rb +80 -51
- data/spec/unit/queueing_rabbit/client/bunny_spec.rb +53 -8
- data/spec/unit/queueing_rabbit/extensions/direct_exchange_spec.rb +20 -0
- data/spec/unit/queueing_rabbit/extensions/new_relic_spec.rb +36 -0
- data/spec/unit/queueing_rabbit/extensions/retryable_spec.rb +36 -0
- data/spec/unit/queueing_rabbit/job_spec.rb +76 -4
- data/spec/unit/queueing_rabbit/jobs/abstract_job_spec.rb +73 -0
- data/spec/unit/queueing_rabbit/jobs/json_job_spec.rb +22 -0
- data/spec/unit/queueing_rabbit/worker_spec.rb +33 -23
- data/spec/unit/queueing_rabbit_spec.rb +55 -25
- metadata +111 -90
- data/spec/support/shared_examples.rb +0 -37
metadata
CHANGED
@@ -1,95 +1,98 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: queueing_rabbit
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 3
|
10
|
-
version: 0.1.3
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Artem Chistyakov
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-08-25 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: amqp
|
22
|
-
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.0.0
|
23
22
|
type: :runtime
|
24
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
|
31
|
-
- 0
|
32
|
-
- 9
|
33
|
-
- 0
|
34
|
-
version: 0.9.0
|
35
|
-
requirement: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.0.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
37
31
|
name: bunny
|
38
|
-
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.10.0
|
39
38
|
type: :runtime
|
40
|
-
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
|
46
|
-
|
47
|
-
- 0
|
48
|
-
- 9
|
49
|
-
- 0
|
50
|
-
- pre
|
51
|
-
- 7
|
52
|
-
version: 0.9.0.pre7
|
53
|
-
requirement: *id002
|
54
|
-
- !ruby/object:Gem::Dependency
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.10.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
55
47
|
name: rake
|
56
|
-
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
57
54
|
type: :runtime
|
58
|
-
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
57
|
none: false
|
60
|
-
requirements:
|
61
|
-
- -
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
|
64
|
-
|
65
|
-
- 0
|
66
|
-
version: "0"
|
67
|
-
requirement: *id003
|
68
|
-
- !ruby/object:Gem::Dependency
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
69
63
|
name: json
|
70
|
-
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
71
70
|
type: :runtime
|
72
|
-
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
|
-
requirements:
|
75
|
-
- -
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
description: ! " QueueingRabbit is a Ruby library providing convenient object-oriented
|
79
|
+
syntax\n for managing background jobs using AMQP. The library implements amqp
|
80
|
+
and\n bunny gems as adapters making it possible to use synchronous publishing
|
81
|
+
and\n asynchronous consuming, which might be useful for Rails app running on\n
|
82
|
+
\ non-EventMachine based application servers (i. e. Passenger).\n\n Any Ruby
|
83
|
+
class or Module can be transformed into QueueingRabbit's background\n job by
|
84
|
+
including QueueingRabbit::Job module. It is also possible to inherit\n your class
|
85
|
+
from QueueingRabbit::AbstractJob abstract class.\n\n The library is bundled with
|
86
|
+
a Rake task which is capable of starting a\n worker processing a specified list
|
87
|
+
of jobs.\n"
|
88
|
+
email:
|
84
89
|
- chistyakov.artem@gmail.com
|
85
90
|
executables: []
|
86
|
-
|
87
91
|
extensions: []
|
88
|
-
|
89
|
-
extra_rdoc_files:
|
92
|
+
extra_rdoc_files:
|
90
93
|
- LICENSE
|
91
94
|
- README.md
|
92
|
-
files:
|
95
|
+
files:
|
93
96
|
- .gitignore
|
94
97
|
- .rvmrc
|
95
98
|
- .travis.yml
|
@@ -103,8 +106,12 @@ files:
|
|
103
106
|
- lib/queueing_rabbit/client/bunny.rb
|
104
107
|
- lib/queueing_rabbit/client/callbacks.rb
|
105
108
|
- lib/queueing_rabbit/configuration.rb
|
109
|
+
- lib/queueing_rabbit/extensions/direct_exchange.rb
|
106
110
|
- lib/queueing_rabbit/extensions/new_relic.rb
|
111
|
+
- lib/queueing_rabbit/extensions/retryable.rb
|
107
112
|
- lib/queueing_rabbit/job.rb
|
113
|
+
- lib/queueing_rabbit/jobs/abstract_job.rb
|
114
|
+
- lib/queueing_rabbit/jobs/json_job.rb
|
108
115
|
- lib/queueing_rabbit/logging.rb
|
109
116
|
- lib/queueing_rabbit/serializer.rb
|
110
117
|
- lib/queueing_rabbit/tasks.rb
|
@@ -113,69 +120,83 @@ files:
|
|
113
120
|
- lib/tasks/queueing_rabbit.rake
|
114
121
|
- queueing_rabbit.gemspec
|
115
122
|
- spec/integration/asynchronous_publishing_and_consuming_spec.rb
|
123
|
+
- spec/integration/asynchronous_publishing_and_consuming_with_retries_spec.rb
|
124
|
+
- spec/integration/direct_exchange_asynchronous_publishing_and_consuming_spec.rb
|
116
125
|
- spec/integration/jobs/print_line_job.rb
|
126
|
+
- spec/integration/json_job_asynchronous_publishing_and_consuming_spec.rb
|
127
|
+
- spec/integration/persistent_asynchronous_publishing_and_consuming_spec.rb
|
117
128
|
- spec/integration/synchronous_publishing_and_asynchronous_consuming_spec.rb
|
118
129
|
- spec/integration/synchronous_publishing_spec.rb
|
119
130
|
- spec/spec_helper.rb
|
120
131
|
- spec/support/shared_contexts.rb
|
121
|
-
- spec/support/shared_examples.rb
|
122
132
|
- spec/unit/queueing_rabbit/callbacks_spec.rb
|
123
133
|
- spec/unit/queueing_rabbit/client/amqp_spec.rb
|
124
134
|
- spec/unit/queueing_rabbit/client/bunny_spec.rb
|
125
135
|
- spec/unit/queueing_rabbit/client/callbacks_spec.rb
|
126
136
|
- spec/unit/queueing_rabbit/configuration_spec.rb
|
137
|
+
- spec/unit/queueing_rabbit/extensions/direct_exchange_spec.rb
|
138
|
+
- spec/unit/queueing_rabbit/extensions/new_relic_spec.rb
|
139
|
+
- spec/unit/queueing_rabbit/extensions/retryable_spec.rb
|
127
140
|
- spec/unit/queueing_rabbit/job_spec.rb
|
141
|
+
- spec/unit/queueing_rabbit/jobs/abstract_job_spec.rb
|
142
|
+
- spec/unit/queueing_rabbit/jobs/json_job_spec.rb
|
128
143
|
- spec/unit/queueing_rabbit/logging_spec.rb
|
129
144
|
- spec/unit/queueing_rabbit/serializer_spec.rb
|
130
145
|
- spec/unit/queueing_rabbit/worker_spec.rb
|
131
146
|
- spec/unit/queueing_rabbit_spec.rb
|
132
147
|
homepage: https://github.com/temochka/queueing_rabbit
|
133
148
|
licenses: []
|
134
|
-
|
135
149
|
post_install_message:
|
136
|
-
rdoc_options:
|
150
|
+
rdoc_options:
|
137
151
|
- --charset=UTF-8
|
138
|
-
require_paths:
|
152
|
+
require_paths:
|
139
153
|
- lib
|
140
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
154
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
141
155
|
none: false
|
142
|
-
requirements:
|
143
|
-
- -
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
|
146
|
-
segments:
|
156
|
+
requirements:
|
157
|
+
- - ! '>='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
segments:
|
147
161
|
- 0
|
148
|
-
|
149
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
|
+
hash: 1551199674468222580
|
163
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
164
|
none: false
|
151
|
-
requirements:
|
152
|
-
- -
|
153
|
-
- !ruby/object:Gem::Version
|
154
|
-
|
155
|
-
segments:
|
165
|
+
requirements:
|
166
|
+
- - ! '>='
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '0'
|
169
|
+
segments:
|
156
170
|
- 0
|
157
|
-
|
171
|
+
hash: 1551199674468222580
|
158
172
|
requirements: []
|
159
|
-
|
160
173
|
rubyforge_project:
|
161
|
-
rubygems_version: 1.8.
|
174
|
+
rubygems_version: 1.8.25
|
162
175
|
signing_key:
|
163
176
|
specification_version: 3
|
164
177
|
summary: QueueingRabbit is an AMQP-based queueing system
|
165
|
-
test_files:
|
178
|
+
test_files:
|
166
179
|
- spec/integration/asynchronous_publishing_and_consuming_spec.rb
|
180
|
+
- spec/integration/asynchronous_publishing_and_consuming_with_retries_spec.rb
|
181
|
+
- spec/integration/direct_exchange_asynchronous_publishing_and_consuming_spec.rb
|
167
182
|
- spec/integration/jobs/print_line_job.rb
|
183
|
+
- spec/integration/json_job_asynchronous_publishing_and_consuming_spec.rb
|
184
|
+
- spec/integration/persistent_asynchronous_publishing_and_consuming_spec.rb
|
168
185
|
- spec/integration/synchronous_publishing_and_asynchronous_consuming_spec.rb
|
169
186
|
- spec/integration/synchronous_publishing_spec.rb
|
170
187
|
- spec/spec_helper.rb
|
171
188
|
- spec/support/shared_contexts.rb
|
172
|
-
- spec/support/shared_examples.rb
|
173
189
|
- spec/unit/queueing_rabbit/callbacks_spec.rb
|
174
190
|
- spec/unit/queueing_rabbit/client/amqp_spec.rb
|
175
191
|
- spec/unit/queueing_rabbit/client/bunny_spec.rb
|
176
192
|
- spec/unit/queueing_rabbit/client/callbacks_spec.rb
|
177
193
|
- spec/unit/queueing_rabbit/configuration_spec.rb
|
194
|
+
- spec/unit/queueing_rabbit/extensions/direct_exchange_spec.rb
|
195
|
+
- spec/unit/queueing_rabbit/extensions/new_relic_spec.rb
|
196
|
+
- spec/unit/queueing_rabbit/extensions/retryable_spec.rb
|
178
197
|
- spec/unit/queueing_rabbit/job_spec.rb
|
198
|
+
- spec/unit/queueing_rabbit/jobs/abstract_job_spec.rb
|
199
|
+
- spec/unit/queueing_rabbit/jobs/json_job_spec.rb
|
179
200
|
- spec/unit/queueing_rabbit/logging_spec.rb
|
180
201
|
- spec/unit/queueing_rabbit/serializer_spec.rb
|
181
202
|
- spec/unit/queueing_rabbit/worker_spec.rb
|
@@ -1,37 +0,0 @@
|
|
1
|
-
shared_examples :client do
|
2
|
-
|
3
|
-
describe '#define_exchange' do
|
4
|
-
let(:channel) { mock }
|
5
|
-
let(:options) { {:durable => true} }
|
6
|
-
|
7
|
-
before do
|
8
|
-
channel.should_receive(:direct).
|
9
|
-
with(QueueingRabbit.amqp_exchange_name,
|
10
|
-
QueueingRabbit.amqp_exchange_options.merge(options))
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'defines a new AMQP direct exchange with given name and options' do
|
14
|
-
client.define_exchange(channel, options)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe '#enqueue' do
|
19
|
-
let(:channel) { mock }
|
20
|
-
let(:exchange) { mock }
|
21
|
-
let(:routing_key) { :routing_key }
|
22
|
-
let(:payload) { {"test" => "data"} }
|
23
|
-
|
24
|
-
before do
|
25
|
-
client.should_receive(:exchange).with(channel).and_return(exchange)
|
26
|
-
exchange.should_receive(:publish).with(JSON.dump(payload),
|
27
|
-
:key => routing_key.to_s,
|
28
|
-
:persistent => true)
|
29
|
-
end
|
30
|
-
|
31
|
-
it "publishes a new persistent message to the used exchange with " \
|
32
|
-
"serialized payload and routed using given routing key" do
|
33
|
-
client.enqueue(channel, routing_key, payload)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|