rabbit_feed 2.3.6 → 2.3.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 100993651bddbcb662add54fe4db5be3db46439d
4
- data.tar.gz: 5ae96791560268be3d76e40436269c767de1446f
3
+ metadata.gz: 46ec22406bf0b402aac611249d2d6d6f73d68f5a
4
+ data.tar.gz: a818565a86d18854c86462fa98c28c0be45b7913
5
5
  SHA512:
6
- metadata.gz: d729b0569a3bd6d8467bb561f36223b8d8b6d058efc0bd54f24f2670b0f249faff7181bf42bd38ce4cad3044e7746919274945dff20a2638c56342deac3ae4a9
7
- data.tar.gz: e0a7f4a72d52d06857d4fed99ac5ddeb22adb8eefc6ffcfa8244dbe0859740b188d0520213fce8766726d56c2726239cf4cf781a9c17fa25b0dfc2f7a6bd72c9
6
+ metadata.gz: ecc5101d86353f8377943623d8b7805f7ef6101b7d90092ed97cb60396a9dcb5573081562c01a36f2bdc3504e83e7515448c8aca60225d9985a64b5de0a1f337
7
+ data.tar.gz: 1da54c92be195050c2815a3a84a2a3be37aa99e2a00b15ba6edddc24dc4e4594cccf7aba620b0f358fbdc217fa033f00a9e433f9d2d4d2551ecad4ad8b66b96d
data/.gitignore CHANGED
@@ -9,3 +9,4 @@ pkg
9
9
  *.iml
10
10
  .idea/
11
11
  *.gem
12
+ Gemfile.lock
data/Gemfile CHANGED
@@ -2,15 +2,3 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in rabbit_feed.gemspec
4
4
  gemspec
5
-
6
- group :development, :test do
7
- gem 'pry-plus'
8
- gem 'rake'
9
- end
10
-
11
- group :test do
12
- gem 'codeclimate-test-reporter'
13
- gem 'rspec-its'
14
- gem 'rutabaga'
15
- gem 'timecop'
16
- end
data/README.md CHANGED
@@ -53,6 +53,7 @@ Configuration options that can be specified are:
53
53
  | `network_recovery_interval` | Recovery interval (in seconds) periodic network recovery will use |
54
54
  | `auto_delete_queue` | If true, any queues created will auto-delete upon disconnect |
55
55
  | `auto_delete_exchange` | If true, any exchanges created will auto-delete upon disconnect |
56
+ | `route_prefix_extension` | If set, the routing key/queue of the exchange will become env.`route_prefix_extension`.application.event |
56
57
 
57
58
  ### Initialisation
58
59
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../../
3
3
  specs:
4
- rabbit_feed (2.3.6)
4
+ rabbit_feed (2.3.7)
5
5
  activemodel (>= 3.2.0, < 5.0.0)
6
6
  activesupport (>= 3.2.0, < 5.0.0)
7
7
  avro (>= 1.5.4, < 1.8.0)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../../
3
3
  specs:
4
- rabbit_feed (2.3.6)
4
+ rabbit_feed (2.3.7)
5
5
  activemodel (>= 3.2.0, < 5.0.0)
6
6
  activesupport (>= 3.2.0, < 5.0.0)
7
7
  avro (>= 1.5.4, < 1.8.0)
@@ -2,7 +2,8 @@ module RabbitFeed
2
2
  class Configuration
3
3
  include ActiveModel::Validations
4
4
 
5
- attr_reader :host, :hosts, :port, :user, :password, :application, :environment, :exchange, :heartbeat, :connect_timeout, :network_recovery_interval, :auto_delete_queue, :auto_delete_exchange
5
+ attr_reader :host, :hosts, :port, :user, :password, :application, :environment, :exchange, :heartbeat,
6
+ :connect_timeout, :network_recovery_interval, :auto_delete_queue, :auto_delete_exchange
6
7
  validates_presence_of :application, :environment, :exchange
7
8
 
8
9
  def initialize options
@@ -21,6 +22,7 @@ module RabbitFeed
21
22
  @auto_delete_exchange = !!(options[:auto_delete_exchange] || false)
22
23
  @application = options[:application]
23
24
  @environment = options[:environment]
25
+ @route_prefix_extension = options[:route_prefix_extension]
24
26
  validate!
25
27
  end
26
28
 
@@ -35,8 +37,12 @@ module RabbitFeed
35
37
  new options
36
38
  end
37
39
 
40
+ def route_prefix_extension
41
+ ".#{@route_prefix_extension}" unless @route_prefix_extension.blank?
42
+ end
43
+
38
44
  def queue
39
- "#{environment}.#{application}"
45
+ "#{environment}#{route_prefix_extension}.#{application}"
40
46
  end
41
47
 
42
48
  def connection_options
@@ -53,7 +53,7 @@ module RabbitFeed
53
53
 
54
54
  def accepted_routes
55
55
  all_events.map do |event|
56
- "#{RabbitFeed.environment}.#{name}.#{event.name}"
56
+ "#{RabbitFeed.environment}#{RabbitFeed.configuration.route_prefix_extension}.#{name}.#{event.name}"
57
57
  end
58
58
  end
59
59
 
@@ -31,7 +31,7 @@ module RabbitFeed
31
31
  end
32
32
 
33
33
  def routing_key event_name
34
- "#{RabbitFeed.environment}.#{RabbitFeed.configuration.application}.#{event_name}"
34
+ "#{RabbitFeed.environment}#{RabbitFeed.configuration.route_prefix_extension}.#{RabbitFeed.configuration.application}.#{event_name}"
35
35
  end
36
36
 
37
37
  def options event_name, timestamp
@@ -1,3 +1,3 @@
1
1
  module RabbitFeed
2
- VERSION = '2.3.6'
2
+ VERSION = '2.3.7'
3
3
  end
data/rabbit_feed.gemspec CHANGED
@@ -28,6 +28,11 @@ Gem::Specification.new do |spec|
28
28
  spec.add_dependency 'pidfile'
29
29
  # Schema definitions and serialization for events
30
30
  spec.add_dependency 'avro', '>= 1.5.4', '< 1.8.0'
31
- # For stubbing and custom matchers
31
+
32
+ spec.add_development_dependency 'codeclimate-test-reporter'
33
+ spec.add_development_dependency 'rake'
32
34
  spec.add_development_dependency 'rspec', '>=2.14.0', '< 3.3.0'
35
+ spec.add_development_dependency 'rspec-its'
36
+ spec.add_development_dependency 'rutabaga'
37
+ spec.add_development_dependency 'timecop'
33
38
  end
@@ -5,6 +5,14 @@ test:
5
5
  password: guest
6
6
  application: rabbit_feed
7
7
  auto_delete_queue: true
8
+ test_route_prefix_extension:
9
+ host: localhost
10
+ port: 5672
11
+ user: guest
12
+ password: guest
13
+ application: rabbit_feed
14
+ auto_delete_queue: true
15
+ route_prefix_extension: foobar
8
16
  test_config:
9
17
  host: localhost
10
18
  port: 5672
@@ -11,6 +11,18 @@ module RabbitFeed
11
11
  subject { (described_class.new options).queue }
12
12
 
13
13
  it { should eq 'test.rabbit_feed' }
14
+
15
+ context 'when a route_prefix_extension is set' do
16
+ let(:options) do
17
+ {
18
+ application: 'rabbit_feed',
19
+ environment: 'test',
20
+ route_prefix_extension: 'foobar'
21
+ }
22
+ end
23
+
24
+ it { should eq 'test.foobar.rabbit_feed' }
25
+ end
14
26
  end
15
27
 
16
28
  describe '#connection_options' do
@@ -29,6 +29,18 @@ module RabbitFeed
29
29
  expect(bunny_channel).to receive(:prefetch).with(1)
30
30
  subject
31
31
  end
32
+
33
+ context 'when a route_prefix_extension is set' do
34
+ before { RabbitFeed.environment = 'test_route_prefix_extension' }
35
+ after { reset_environment }
36
+
37
+ it 'appends the route_prefix_extension to the routing_key' do
38
+ expect(bunny_queue).to receive(:bind).with('amq.topic',
39
+ { routing_key: 'test_route_prefix_extension.foobar.rabbit_feed.test'}
40
+ )
41
+ subject
42
+ end
43
+ end
32
44
  end
33
45
 
34
46
  describe '#consume' do
@@ -68,6 +68,20 @@ module RabbitFeed
68
68
  subject
69
69
  end
70
70
  end
71
+
72
+ context 'when a route_prefix_extension is set' do
73
+ before { RabbitFeed.environment = 'test_route_prefix_extension' }
74
+ after { reset_environment }
75
+
76
+ it 'appends the route_prefix_extension to the routing_key' do
77
+ Timecop.freeze do
78
+ expect(ProducerConnection.instance).to receive(:publish) do |_, options|
79
+ expect(options[:routing_key]).to eq 'test_route_prefix_extension.foobar.rabbit_feed.event_name'
80
+ end
81
+ subject
82
+ end
83
+ end
84
+ end
71
85
  end
72
86
  end
73
87
  end
data/spec/spec_helper.rb CHANGED
@@ -41,6 +41,7 @@ def reset_environment
41
41
  RabbitFeed.log = RabbitFeed.default_logger
42
42
  RabbitFeed.environment = 'test'
43
43
  RabbitFeed.configuration_file_path = 'spec/fixtures/configuration.yml'
44
+ RabbitFeed.instance_variable_set('@configuration', nil)
44
45
  RabbitFeed::Consumer.event_routing = nil
45
46
  RabbitFeed::Producer.event_definitions = nil
46
47
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabbit_feed
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.6
4
+ version: 2.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simply Business
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-19 00:00:00.000000000 Z
11
+ date: 2016-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny
@@ -104,6 +104,34 @@ dependencies:
104
104
  - - "<"
105
105
  - !ruby/object:Gem::Version
106
106
  version: 1.8.0
107
+ - !ruby/object:Gem::Dependency
108
+ name: codeclimate-test-reporter
109
+ requirement: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ type: :development
115
+ prerelease: false
116
+ version_requirements: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ - !ruby/object:Gem::Dependency
122
+ name: rake
123
+ requirement: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ type: :development
129
+ prerelease: false
130
+ version_requirements: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
107
135
  - !ruby/object:Gem::Dependency
108
136
  name: rspec
109
137
  requirement: !ruby/object:Gem::Requirement
@@ -124,6 +152,48 @@ dependencies:
124
152
  - - "<"
125
153
  - !ruby/object:Gem::Version
126
154
  version: 3.3.0
155
+ - !ruby/object:Gem::Dependency
156
+ name: rspec-its
157
+ requirement: !ruby/object:Gem::Requirement
158
+ requirements:
159
+ - - ">="
160
+ - !ruby/object:Gem::Version
161
+ version: '0'
162
+ type: :development
163
+ prerelease: false
164
+ version_requirements: !ruby/object:Gem::Requirement
165
+ requirements:
166
+ - - ">="
167
+ - !ruby/object:Gem::Version
168
+ version: '0'
169
+ - !ruby/object:Gem::Dependency
170
+ name: rutabaga
171
+ requirement: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - ">="
174
+ - !ruby/object:Gem::Version
175
+ version: '0'
176
+ type: :development
177
+ prerelease: false
178
+ version_requirements: !ruby/object:Gem::Requirement
179
+ requirements:
180
+ - - ">="
181
+ - !ruby/object:Gem::Version
182
+ version: '0'
183
+ - !ruby/object:Gem::Dependency
184
+ name: timecop
185
+ requirement: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - ">="
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ type: :development
191
+ prerelease: false
192
+ version_requirements: !ruby/object:Gem::Requirement
193
+ requirements:
194
+ - - ">="
195
+ - !ruby/object:Gem::Version
196
+ version: '0'
127
197
  description: A gem providing asynchronous event publish and subscribe capabilities
128
198
  with RabbitMQ.
129
199
  email:
@@ -138,7 +208,6 @@ files:
138
208
  - Brewfile
139
209
  - DEVELOPING.md
140
210
  - Gemfile
141
- - Gemfile.lock
142
211
  - LICENSE.txt
143
212
  - README.md
144
213
  - Rakefile
@@ -297,7 +366,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
297
366
  version: '0'
298
367
  requirements: []
299
368
  rubyforge_project:
300
- rubygems_version: 2.4.7
369
+ rubygems_version: 2.4.5.1
301
370
  signing_key:
302
371
  specification_version: 4
303
372
  summary: Enables your Ruby applications to perform centralized event logging with
data/Gemfile.lock DELETED
@@ -1,131 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- rabbit_feed (2.3.6)
5
- activemodel (>= 3.2.0, < 5.0.0)
6
- activesupport (>= 3.2.0, < 5.0.0)
7
- avro (>= 1.5.4, < 1.8.0)
8
- bunny (>= 2.0.0, < 2.1.0)
9
- pidfile
10
-
11
- GEM
12
- remote: https://rubygems.org/
13
- specs:
14
- activemodel (4.2.5)
15
- activesupport (= 4.2.5)
16
- builder (~> 3.1)
17
- activesupport (4.2.5)
18
- i18n (~> 0.7)
19
- json (~> 1.7, >= 1.7.7)
20
- minitest (~> 5.1)
21
- thread_safe (~> 0.3, >= 0.3.4)
22
- tzinfo (~> 1.1)
23
- amq-protocol (2.0.1)
24
- avro (1.7.7)
25
- multi_json
26
- binding_of_caller (0.7.2)
27
- debug_inspector (>= 0.0.1)
28
- bond (0.5.1)
29
- builder (3.2.2)
30
- bunny (2.0.1)
31
- amq-protocol (>= 1.9.2)
32
- codeclimate-test-reporter (0.4.6)
33
- simplecov (>= 0.7.1, < 1.0.0)
34
- coderay (1.1.0)
35
- columnize (0.9.0)
36
- debug_inspector (0.0.2)
37
- debugger (1.6.8)
38
- columnize (>= 0.3.1)
39
- debugger-linecache (~> 1.2.0)
40
- debugger-ruby_core_source (~> 1.3.5)
41
- debugger-linecache (1.2.0)
42
- debugger-ruby_core_source (1.3.8)
43
- diff-lcs (1.2.5)
44
- docile (1.1.5)
45
- gherkin (2.12.2)
46
- multi_json (~> 1.3)
47
- i18n (0.7.0)
48
- interception (0.5)
49
- jist (1.5.1)
50
- json
51
- json (1.8.2)
52
- method_source (0.8.2)
53
- minitest (5.8.3)
54
- multi_json (1.10.1)
55
- pidfile (0.3.0)
56
- pry (0.10.1)
57
- coderay (~> 1.1.0)
58
- method_source (~> 0.8.1)
59
- slop (~> 3.4)
60
- pry-debugger (0.2.3)
61
- debugger (~> 1.3)
62
- pry (>= 0.9.10, < 0.11.0)
63
- pry-doc (0.6.0)
64
- pry (~> 0.9)
65
- yard (~> 0.8)
66
- pry-docmore (0.1.1)
67
- pry
68
- pry-doc
69
- pry-plus (1.0.0)
70
- bond
71
- jist
72
- pry-debugger
73
- pry-doc
74
- pry-docmore
75
- pry-rescue
76
- pry-stack_explorer
77
- pry-rescue (1.4.1)
78
- interception (>= 0.5)
79
- pry
80
- pry-stack_explorer (0.4.9.2)
81
- binding_of_caller (>= 0.7)
82
- pry (>= 0.9.11)
83
- rake (10.4.2)
84
- rspec (3.2.0)
85
- rspec-core (~> 3.2.0)
86
- rspec-expectations (~> 3.2.0)
87
- rspec-mocks (~> 3.2.0)
88
- rspec-core (3.2.0)
89
- rspec-support (~> 3.2.0)
90
- rspec-expectations (3.2.0)
91
- diff-lcs (>= 1.2.0, < 2.0)
92
- rspec-support (~> 3.2.0)
93
- rspec-its (1.2.0)
94
- rspec-core (>= 3.0.0)
95
- rspec-expectations (>= 3.0.0)
96
- rspec-mocks (3.2.0)
97
- diff-lcs (>= 1.2.0, < 2.0)
98
- rspec-support (~> 3.2.0)
99
- rspec-support (3.2.1)
100
- rutabaga (0.1.1)
101
- turnip (>= 1.1.0, < 2.0)
102
- simplecov (0.9.2)
103
- docile (~> 1.1.0)
104
- multi_json (~> 1.0)
105
- simplecov-html (~> 0.9.0)
106
- simplecov-html (0.9.0)
107
- slop (3.6.0)
108
- thread_safe (0.3.5)
109
- timecop (0.7.3)
110
- turnip (1.2.4)
111
- gherkin (>= 2.5)
112
- rspec (>= 2.14.0, < 4.0)
113
- tzinfo (1.2.2)
114
- thread_safe (~> 0.1)
115
- yard (0.8.7.6)
116
-
117
- PLATFORMS
118
- ruby
119
-
120
- DEPENDENCIES
121
- codeclimate-test-reporter
122
- pry-plus
123
- rabbit_feed!
124
- rake
125
- rspec (>= 2.14.0, < 3.3.0)
126
- rspec-its
127
- rutabaga
128
- timecop
129
-
130
- BUNDLED WITH
131
- 1.10.5