beetle 0.4.11 → 0.4.12
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a50fa533c34e2207f31db5221a603d77c44d9c15
|
4
|
+
data.tar.gz: aee7aaaa983332ad75b6ff4f685c946a65943157
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af16207ccd97dc0318e915a7efeff737af67b5a39a868a8f33dd1a1a2038f84f79f36ef6aba1c18a4c75badd9851e787a0b5c766f9f0a86d98f770dd184bb7b6
|
7
|
+
data.tar.gz: 326faf02f95fe79bdbbb0e264326f05ca1620717b9297814d7626d951bf36c9326655afb161f47344f112302653e321d28266f0729c29345fd1ecc60f7de92d6
|
data/RELEASE_NOTES.rdoc
CHANGED
data/lib/beetle/publisher.rb
CHANGED
@@ -2,6 +2,8 @@ module Beetle
|
|
2
2
|
# Provides the publishing logic implementation.
|
3
3
|
class Publisher < Base
|
4
4
|
|
5
|
+
attr_reader :dead_servers
|
6
|
+
|
5
7
|
def initialize(client, options = {}) #:nodoc:
|
6
8
|
super
|
7
9
|
@exchanges_with_bound_queues = {}
|
@@ -63,7 +65,7 @@ module Beetle
|
|
63
65
|
|
64
66
|
def publish_with_redundancy(exchange_name, message_name, data, opts) #:nodoc:
|
65
67
|
if @servers.size < 2
|
66
|
-
logger.warn "Beetle: at least two active servers are required for redundant publishing"
|
68
|
+
logger.warn "Beetle: at least two active servers are required for redundant publishing" if @dead_servers.size > 0
|
67
69
|
return publish_with_failover(exchange_name, message_name, data, opts)
|
68
70
|
end
|
69
71
|
published = []
|
data/lib/beetle/version.rb
CHANGED
File without changes
|
@@ -170,6 +170,37 @@ module Beetle
|
|
170
170
|
assert_equal 2, @pub.publish_with_redundancy("mama-exchange", "mama", @data, @opts)
|
171
171
|
end
|
172
172
|
|
173
|
+
test "redundant publishing should log a warning if only one server is active" do
|
174
|
+
@pub.servers = %w(server1 server2)
|
175
|
+
@pub.server = "server1"
|
176
|
+
@pub.send :mark_server_dead
|
177
|
+
|
178
|
+
redundant = sequence("redundant")
|
179
|
+
e = mock("exchange")
|
180
|
+
|
181
|
+
@pub.logger.expects(:warn).with("Beetle: at least two active servers are required for redundant publishing")
|
182
|
+
|
183
|
+
@pub.expects(:exchange).returns(e).in_sequence(redundant)
|
184
|
+
e.expects(:publish).in_sequence(redundant)
|
185
|
+
|
186
|
+
assert_equal 1, @pub.publish_with_redundancy("mama-exchange", "mama", @data, @opts)
|
187
|
+
end
|
188
|
+
|
189
|
+
test "redundant publishing should not log a warning if only one server exists" do
|
190
|
+
@pub.servers = %w(server1)
|
191
|
+
@pub.server = "server1"
|
192
|
+
|
193
|
+
redundant = sequence("redundant")
|
194
|
+
e = mock("exchange")
|
195
|
+
|
196
|
+
@pub.logger.expects(:warn).with("Beetle: at least two active servers are required for redundant publishing").never
|
197
|
+
|
198
|
+
@pub.expects(:exchange).returns(e).in_sequence(redundant)
|
199
|
+
e.expects(:publish).in_sequence(redundant)
|
200
|
+
|
201
|
+
assert_equal 1, @pub.publish_with_redundancy("mama-exchange", "mama", @data, @opts)
|
202
|
+
end
|
203
|
+
|
173
204
|
test "publishing should use the message ttl passed in the options hash to encode the message body" do
|
174
205
|
opts = {:ttl => 1.day}
|
175
206
|
Message.expects(:publishing_options).with(:ttl => 1.day).returns({})
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beetle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Kaes
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2016-08-
|
15
|
+
date: 2016-08-22 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: uuid4r
|
@@ -248,7 +248,7 @@ files:
|
|
248
248
|
- lib/beetle/subscriber.rb
|
249
249
|
- lib/beetle/version.rb
|
250
250
|
- script/console
|
251
|
-
- script/docker-run-beetle-tests
|
251
|
+
- script/docker-run-beetle-tests-
|
252
252
|
- script/start_rabbit
|
253
253
|
- test/beetle/amqp_gem_behavior_test.rb
|
254
254
|
- test/beetle/base_test.rb
|