beetle 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/RELEASE_NOTES.rdoc +4 -0
- data/features/support/env.rb +5 -4
- data/lib/beetle/deduplication_store.rb +0 -2
- data/lib/beetle/message.rb +4 -0
- data/lib/beetle/publisher.rb +1 -1
- data/lib/beetle/version.rb +1 -1
- data/test/beetle/deduplication_store_test.rb +2 -2
- data/test/beetle/message_test.rb +15 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f2aa62352bfa22c0bcf8b02160027aed3429cd6
|
4
|
+
data.tar.gz: 491a52bbb628b89165e09671e505147d540844bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 383565b61fe2689ac5767b668710762bda352a8c1c37253e351e7c5d527e97dbd240e5346403881cf3cf428b0b2137eea1fddb4cba15ea6eb3a2afb7f8f04205
|
7
|
+
data.tar.gz: 76fd7ccdb3f16680792695778685fca20102575b1c419ffd6e5fa3d4b48917de7abcbf808f109d2cb3fe70a76cd638d18fffd3165aa93fdefd984daec74722c3
|
data/RELEASE_NOTES.rdoc
CHANGED
data/features/support/env.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
require File.expand_path('../../../lib/beetle', __FILE__)
|
2
2
|
|
3
|
-
#
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
# See https://github.com/cucumber/cucumber/wiki/Using-MiniTest
|
4
|
+
require 'minitest/unit'
|
5
|
+
World do
|
6
|
+
extend MiniTest::Assertions
|
7
|
+
end
|
7
8
|
|
8
9
|
Before do
|
9
10
|
`ruby features/support/system_notification_logger start`
|
@@ -189,8 +189,6 @@ module Beetle
|
|
189
189
|
def redis_master_from_master_file
|
190
190
|
set_current_redis_master_from_master_file if redis_master_file_changed?
|
191
191
|
@current_master
|
192
|
-
rescue Errno::ENOENT
|
193
|
-
nil
|
194
192
|
end
|
195
193
|
|
196
194
|
# redis master file changed outside the running process?
|
data/lib/beetle/message.rb
CHANGED
@@ -32,6 +32,8 @@ module Beetle
|
|
32
32
|
attr_reader :header
|
33
33
|
# the uuid of the message
|
34
34
|
attr_reader :uuid
|
35
|
+
# unix timestamp when the message was published
|
36
|
+
attr_reader :timestamp
|
35
37
|
# message payload
|
36
38
|
attr_reader :data
|
37
39
|
# the message format version of the message
|
@@ -76,6 +78,7 @@ module Beetle
|
|
76
78
|
# p header.attributes
|
77
79
|
amqp_headers = header.attributes
|
78
80
|
@uuid = amqp_headers[:message_id]
|
81
|
+
@timestamp = amqp_headers[:timestamp]
|
79
82
|
headers = amqp_headers[:headers].symbolize_keys
|
80
83
|
@format_version = headers[:format_version].to_i
|
81
84
|
@flags = headers[:flags].to_i
|
@@ -92,6 +95,7 @@ module Beetle
|
|
92
95
|
expires_at = now + (opts[:ttl] || DEFAULT_TTL)
|
93
96
|
opts = opts.slice(*PUBLISHING_KEYS)
|
94
97
|
opts[:message_id] = generate_uuid.to_s
|
98
|
+
opts[:timestamp] = now
|
95
99
|
headers = (opts[:headers] ||= {})
|
96
100
|
headers.merge!(
|
97
101
|
:format_version => FORMAT_VERSION.to_s,
|
data/lib/beetle/publisher.rb
CHANGED
@@ -60,7 +60,7 @@ module Beetle
|
|
60
60
|
|
61
61
|
def publish_with_redundancy(exchange_name, message_name, data, opts) #:nodoc:
|
62
62
|
if @servers.size < 2
|
63
|
-
logger.
|
63
|
+
logger.warn "Beetle: at least two active servers are required for redundant publishing"
|
64
64
|
return publish_with_failover(exchange_name, message_name, data, opts)
|
65
65
|
end
|
66
66
|
published = []
|
data/lib/beetle/version.rb
CHANGED
@@ -66,9 +66,9 @@ module Beetle
|
|
66
66
|
2.times { @store.redis }
|
67
67
|
end
|
68
68
|
|
69
|
-
test "should
|
69
|
+
test "should blow up if the master file doesn't exist" do
|
70
70
|
Beetle.config.redis_server = "/tmp/__i_don_not_exist__.txt"
|
71
|
-
|
71
|
+
assert_raises(Errno::ENOENT) { @store.redis_master_from_master_file }
|
72
72
|
end
|
73
73
|
|
74
74
|
private
|
data/test/beetle/message_test.rb
CHANGED
@@ -16,6 +16,13 @@ module Beetle
|
|
16
16
|
assert_equal Message::FORMAT_VERSION, m.format_version
|
17
17
|
end
|
18
18
|
|
19
|
+
test "a message should decode the timestamp" do
|
20
|
+
Message.stubs(:now).returns(42)
|
21
|
+
header = header_with_params()
|
22
|
+
m = Message.new("queue", header, 'foo')
|
23
|
+
assert_equal 42, m.timestamp
|
24
|
+
end
|
25
|
+
|
19
26
|
test "a redundantly encoded message should have the redundant flag set on delivery" do
|
20
27
|
header = header_with_params(:redundant => true)
|
21
28
|
m = Message.new("queue", header, 'foo')
|
@@ -24,14 +31,14 @@ module Beetle
|
|
24
31
|
end
|
25
32
|
|
26
33
|
test "encoding a message with a specfied time to live should set an expiration time" do
|
27
|
-
Message.
|
34
|
+
Message.stubs(:now).returns(25)
|
28
35
|
header = header_with_params(:ttl => 17)
|
29
36
|
m = Message.new("queue", header, 'foo')
|
30
37
|
assert_equal 42, m.expires_at
|
31
38
|
end
|
32
39
|
|
33
40
|
test "encoding a message should set the default expiration date if none is provided in the call to encode" do
|
34
|
-
Message.
|
41
|
+
Message.stubs(:now).returns(1)
|
35
42
|
header = header_with_params({})
|
36
43
|
m = Message.new("queue", header, 'foo')
|
37
44
|
assert_equal 1 + Message::DEFAULT_TTL, m.expires_at
|
@@ -62,6 +69,12 @@ module Beetle
|
|
62
69
|
assert_equal uuid, options[:message_id]
|
63
70
|
end
|
64
71
|
|
72
|
+
test "the publishing options should include the timestamp" do
|
73
|
+
Message.stubs(:now).returns(42)
|
74
|
+
options = Message.publishing_options
|
75
|
+
assert_equal 42, options[:timestamp]
|
76
|
+
end
|
77
|
+
|
65
78
|
test "the publishing options must only include string values" do
|
66
79
|
options = Message.publishing_options(:redundant => true, :mandatory => true, :bogus => true)
|
67
80
|
|
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.2
|
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: 2015-
|
15
|
+
date: 2015-08-25 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: uuid4r
|
@@ -284,7 +284,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
284
284
|
version: 1.3.7
|
285
285
|
requirements: []
|
286
286
|
rubyforge_project:
|
287
|
-
rubygems_version: 2.4.
|
287
|
+
rubygems_version: 2.4.5
|
288
288
|
signing_key:
|
289
289
|
specification_version: 3
|
290
290
|
summary: High Availability AMQP Messaging with Redundant Queues
|