action_subscriber 1.0.3-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +21 -0
- data/.rspec +2 -0
- data/Gemfile +5 -0
- data/LICENSE +20 -0
- data/LICENSE.txt +22 -0
- data/README.md +122 -0
- data/Rakefile +8 -0
- data/action_subscriber.gemspec +38 -0
- data/examples/at_least_once.rb +17 -0
- data/examples/at_most_once.rb +15 -0
- data/examples/basic_subscriber.rb +30 -0
- data/examples/message_acknowledgement.rb +19 -0
- data/lib/action_subscriber.rb +93 -0
- data/lib/action_subscriber/base.rb +83 -0
- data/lib/action_subscriber/bunny/subscriber.rb +57 -0
- data/lib/action_subscriber/configuration.rb +68 -0
- data/lib/action_subscriber/default_routing.rb +26 -0
- data/lib/action_subscriber/dsl.rb +83 -0
- data/lib/action_subscriber/march_hare/subscriber.rb +60 -0
- data/lib/action_subscriber/middleware.rb +18 -0
- data/lib/action_subscriber/middleware/active_record/connection_management.rb +17 -0
- data/lib/action_subscriber/middleware/active_record/query_cache.rb +29 -0
- data/lib/action_subscriber/middleware/decoder.rb +33 -0
- data/lib/action_subscriber/middleware/env.rb +65 -0
- data/lib/action_subscriber/middleware/error_handler.rb +16 -0
- data/lib/action_subscriber/middleware/router.rb +17 -0
- data/lib/action_subscriber/middleware/runner.rb +16 -0
- data/lib/action_subscriber/rabbit_connection.rb +40 -0
- data/lib/action_subscriber/railtie.rb +13 -0
- data/lib/action_subscriber/rspec.rb +91 -0
- data/lib/action_subscriber/subscribable.rb +118 -0
- data/lib/action_subscriber/threadpool.rb +29 -0
- data/lib/action_subscriber/version.rb +3 -0
- data/spec/integration/basic_subscriber_spec.rb +42 -0
- data/spec/lib/action_subscriber/base_spec.rb +18 -0
- data/spec/lib/action_subscriber/configuration_spec.rb +32 -0
- data/spec/lib/action_subscriber/dsl_spec.rb +143 -0
- data/spec/lib/action_subscriber/middleware/active_record/connection_management_spec.rb +17 -0
- data/spec/lib/action_subscriber/middleware/active_record/query_cache_spec.rb +49 -0
- data/spec/lib/action_subscriber/middleware/decoder_spec.rb +31 -0
- data/spec/lib/action_subscriber/middleware/env_spec.rb +60 -0
- data/spec/lib/action_subscriber/middleware/error_handler_spec.rb +35 -0
- data/spec/lib/action_subscriber/middleware/router_spec.rb +24 -0
- data/spec/lib/action_subscriber/middleware/runner_spec.rb +6 -0
- data/spec/lib/action_subscriber/subscribable_spec.rb +128 -0
- data/spec/lib/action_subscriber/threadpool_spec.rb +35 -0
- data/spec/spec_helper.rb +26 -0
- data/spec/support/user_subscriber.rb +6 -0
- metadata +255 -0
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ::ActionSubscriber::Threadpool do
|
4
|
+
describe "busy?" do
|
5
|
+
context "when the workers are busy" do
|
6
|
+
it "returns true" do
|
7
|
+
allow(::ActionSubscriber::Threadpool.pool).to receive(:busy_size).and_return(8)
|
8
|
+
expect(::ActionSubscriber::Threadpool.busy?).to eq(true)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
context "when there are idle workers" do
|
13
|
+
it "returns false" do
|
14
|
+
allow(::ActionSubscriber::Threadpool.pool).to receive(:busy_size).and_return(1)
|
15
|
+
expect(::ActionSubscriber::Threadpool.busy?).to eq(false)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "ready?" do
|
21
|
+
context "when the pool is busy" do
|
22
|
+
it "returns false" do
|
23
|
+
allow(::ActionSubscriber::Threadpool).to receive(:busy?).and_return true
|
24
|
+
expect(::ActionSubscriber::Threadpool.ready?).to eq(false)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context "when the pool is not busy" do
|
29
|
+
it "returns true" do
|
30
|
+
allow(::ActionSubscriber::Threadpool).to receive(:busy?).and_return false
|
31
|
+
expect(::ActionSubscriber::Threadpool.ready?).to eq(true)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
|
4
|
+
require 'simplecov'
|
5
|
+
ENV['APP_NAME'] = 'Alice'
|
6
|
+
|
7
|
+
|
8
|
+
SimpleCov.start do
|
9
|
+
add_filter 'spec'
|
10
|
+
end
|
11
|
+
|
12
|
+
Bundler.require(:default, :development, :test)
|
13
|
+
|
14
|
+
require 'action_subscriber'
|
15
|
+
require 'active_record'
|
16
|
+
|
17
|
+
# Require spec support files
|
18
|
+
require 'support/user_subscriber'
|
19
|
+
|
20
|
+
require 'action_subscriber/rspec'
|
21
|
+
|
22
|
+
RSpec.configure do |config|
|
23
|
+
config.mock_with :rspec do |mocks|
|
24
|
+
mocks.verify_partial_doubles = true
|
25
|
+
end
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,255 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: action_subscriber
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.3
|
5
|
+
platform: java
|
6
|
+
authors:
|
7
|
+
- Brian Stien
|
8
|
+
- Adam Hutchison
|
9
|
+
- Brandon Dewitt
|
10
|
+
- Devin Christensen
|
11
|
+
- Michael Ries
|
12
|
+
autorequire:
|
13
|
+
bindir: bin
|
14
|
+
cert_chain: []
|
15
|
+
date: 2014-11-11 00:00:00.000000000 Z
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3.2'
|
23
|
+
name: activesupport
|
24
|
+
prerelease: false
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
requirements:
|
28
|
+
- - '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '3.2'
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - '>='
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 2.7.0
|
37
|
+
name: march_hare
|
38
|
+
prerelease: false
|
39
|
+
type: :runtime
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 2.7.0
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
requirement: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - '>='
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
name: lifeguard
|
52
|
+
prerelease: false
|
53
|
+
type: :runtime
|
54
|
+
version_requirements: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
requirement: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - '>='
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
name: middleware
|
66
|
+
prerelease: false
|
67
|
+
type: :runtime
|
68
|
+
version_requirements: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
- !ruby/object:Gem::Dependency
|
74
|
+
requirement: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '3.2'
|
79
|
+
name: activerecord
|
80
|
+
prerelease: false
|
81
|
+
type: :development
|
82
|
+
version_requirements: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '3.2'
|
87
|
+
- !ruby/object:Gem::Dependency
|
88
|
+
requirement: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '1.6'
|
93
|
+
name: bundler
|
94
|
+
prerelease: false
|
95
|
+
type: :development
|
96
|
+
version_requirements: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - '>='
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '1.6'
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
requirement: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - '>='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
name: pry-nav
|
108
|
+
prerelease: false
|
109
|
+
type: :development
|
110
|
+
version_requirements: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - '>='
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
requirement: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ~>
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '3.0'
|
121
|
+
name: rspec
|
122
|
+
prerelease: false
|
123
|
+
type: :development
|
124
|
+
version_requirements: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - ~>
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '3.0'
|
129
|
+
- !ruby/object:Gem::Dependency
|
130
|
+
requirement: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - '>='
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
name: rake
|
136
|
+
prerelease: false
|
137
|
+
type: :development
|
138
|
+
version_requirements: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
- !ruby/object:Gem::Dependency
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - '>='
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
name: simplecov
|
150
|
+
prerelease: false
|
151
|
+
type: :development
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - '>='
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0'
|
157
|
+
description: ActionSubscriber is a DSL that allows a rails app to consume messages from a RabbitMQ broker.
|
158
|
+
email:
|
159
|
+
- brianastien@gmail.com
|
160
|
+
- liveh2o@gmail.com
|
161
|
+
- brandonsdewitt@gmail.com
|
162
|
+
- quixoten@gmail.com
|
163
|
+
- michael@riesd.com
|
164
|
+
executables: []
|
165
|
+
extensions: []
|
166
|
+
extra_rdoc_files: []
|
167
|
+
files:
|
168
|
+
- .gitignore
|
169
|
+
- .rspec
|
170
|
+
- Gemfile
|
171
|
+
- LICENSE
|
172
|
+
- LICENSE.txt
|
173
|
+
- README.md
|
174
|
+
- Rakefile
|
175
|
+
- action_subscriber.gemspec
|
176
|
+
- examples/at_least_once.rb
|
177
|
+
- examples/at_most_once.rb
|
178
|
+
- examples/basic_subscriber.rb
|
179
|
+
- examples/message_acknowledgement.rb
|
180
|
+
- lib/action_subscriber.rb
|
181
|
+
- lib/action_subscriber/base.rb
|
182
|
+
- lib/action_subscriber/bunny/subscriber.rb
|
183
|
+
- lib/action_subscriber/configuration.rb
|
184
|
+
- lib/action_subscriber/default_routing.rb
|
185
|
+
- lib/action_subscriber/dsl.rb
|
186
|
+
- lib/action_subscriber/march_hare/subscriber.rb
|
187
|
+
- lib/action_subscriber/middleware.rb
|
188
|
+
- lib/action_subscriber/middleware/active_record/connection_management.rb
|
189
|
+
- lib/action_subscriber/middleware/active_record/query_cache.rb
|
190
|
+
- lib/action_subscriber/middleware/decoder.rb
|
191
|
+
- lib/action_subscriber/middleware/env.rb
|
192
|
+
- lib/action_subscriber/middleware/error_handler.rb
|
193
|
+
- lib/action_subscriber/middleware/router.rb
|
194
|
+
- lib/action_subscriber/middleware/runner.rb
|
195
|
+
- lib/action_subscriber/rabbit_connection.rb
|
196
|
+
- lib/action_subscriber/railtie.rb
|
197
|
+
- lib/action_subscriber/rspec.rb
|
198
|
+
- lib/action_subscriber/subscribable.rb
|
199
|
+
- lib/action_subscriber/threadpool.rb
|
200
|
+
- lib/action_subscriber/version.rb
|
201
|
+
- spec/integration/basic_subscriber_spec.rb
|
202
|
+
- spec/lib/action_subscriber/base_spec.rb
|
203
|
+
- spec/lib/action_subscriber/configuration_spec.rb
|
204
|
+
- spec/lib/action_subscriber/dsl_spec.rb
|
205
|
+
- spec/lib/action_subscriber/middleware/active_record/connection_management_spec.rb
|
206
|
+
- spec/lib/action_subscriber/middleware/active_record/query_cache_spec.rb
|
207
|
+
- spec/lib/action_subscriber/middleware/decoder_spec.rb
|
208
|
+
- spec/lib/action_subscriber/middleware/env_spec.rb
|
209
|
+
- spec/lib/action_subscriber/middleware/error_handler_spec.rb
|
210
|
+
- spec/lib/action_subscriber/middleware/router_spec.rb
|
211
|
+
- spec/lib/action_subscriber/middleware/runner_spec.rb
|
212
|
+
- spec/lib/action_subscriber/subscribable_spec.rb
|
213
|
+
- spec/lib/action_subscriber/threadpool_spec.rb
|
214
|
+
- spec/spec_helper.rb
|
215
|
+
- spec/support/user_subscriber.rb
|
216
|
+
homepage: ''
|
217
|
+
licenses:
|
218
|
+
- MIT
|
219
|
+
metadata: {}
|
220
|
+
post_install_message:
|
221
|
+
rdoc_options: []
|
222
|
+
require_paths:
|
223
|
+
- lib
|
224
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
225
|
+
requirements:
|
226
|
+
- - '>='
|
227
|
+
- !ruby/object:Gem::Version
|
228
|
+
version: '0'
|
229
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
230
|
+
requirements:
|
231
|
+
- - '>='
|
232
|
+
- !ruby/object:Gem::Version
|
233
|
+
version: '0'
|
234
|
+
requirements: []
|
235
|
+
rubyforge_project:
|
236
|
+
rubygems_version: 2.1.9
|
237
|
+
signing_key:
|
238
|
+
specification_version: 4
|
239
|
+
summary: ActionSubscriber is a DSL that allows a rails app to consume messages from a RabbitMQ broker.
|
240
|
+
test_files:
|
241
|
+
- spec/integration/basic_subscriber_spec.rb
|
242
|
+
- spec/lib/action_subscriber/base_spec.rb
|
243
|
+
- spec/lib/action_subscriber/configuration_spec.rb
|
244
|
+
- spec/lib/action_subscriber/dsl_spec.rb
|
245
|
+
- spec/lib/action_subscriber/middleware/active_record/connection_management_spec.rb
|
246
|
+
- spec/lib/action_subscriber/middleware/active_record/query_cache_spec.rb
|
247
|
+
- spec/lib/action_subscriber/middleware/decoder_spec.rb
|
248
|
+
- spec/lib/action_subscriber/middleware/env_spec.rb
|
249
|
+
- spec/lib/action_subscriber/middleware/error_handler_spec.rb
|
250
|
+
- spec/lib/action_subscriber/middleware/router_spec.rb
|
251
|
+
- spec/lib/action_subscriber/middleware/runner_spec.rb
|
252
|
+
- spec/lib/action_subscriber/subscribable_spec.rb
|
253
|
+
- spec/lib/action_subscriber/threadpool_spec.rb
|
254
|
+
- spec/spec_helper.rb
|
255
|
+
- spec/support/user_subscriber.rb
|