mantle 2.2.0 → 2.3.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +27 -0
- data/Gemfile.lock +13 -61
- data/bin/mantle +0 -1
- data/lib/mantle/configuration.rb +2 -1
- data/lib/mantle/message.rb +5 -0
- data/lib/mantle/message_router.rb +10 -1
- data/lib/mantle/version.rb +1 -1
- data/mantle.gemspec +3 -3
- data/spec/lib/mantle/configuration_spec.rb +6 -0
- data/spec/lib/mantle/message_router_spec.rb +11 -0
- data/spec/lib/mantle/message_spec.rb +26 -4
- metadata +10 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e24cffc1a3d9c51dc93dd6aa0fd396e24aeff9a
|
4
|
+
data.tar.gz: 57e10d3a48e432da1b359c17126b6fd7eb367f6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17b7275b739d2086b3fa22b2730dfc0b72c8ade28d440d00210ddc7810f833210cd14330bee417c09e0dcd68e114f1047cf375ec323082177c069c716ad5471e
|
7
|
+
data.tar.gz: a42c3207857ebf616388d30780341a853fa8e9218e81b2332caedddb6db3afe1c16f93e03d59a910f75c94245011efdb9cd1b5b99642b6c8a7c4ca915f004e6e
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,30 @@
|
|
1
|
+
2.3.0
|
2
|
+
-----------
|
3
|
+
|
4
|
+
- Requires `sidekiq` versions `5.x` (previous releases required versions `4.x`)
|
5
|
+
|
6
|
+
2.2.4
|
7
|
+
-----------
|
8
|
+
|
9
|
+
- Add `whoami` to mantle config so an app can tag published messages
|
10
|
+
- Add `message_source` as a `__MANTLE__` payload so consumers can identify sender
|
11
|
+
|
12
|
+
2.2.3
|
13
|
+
-----------
|
14
|
+
|
15
|
+
- Remove reference to `Celluloid` as Sidekiq no longer depends on it
|
16
|
+
|
17
|
+
2.2.2
|
18
|
+
-----------
|
19
|
+
|
20
|
+
- Better formatted error messages
|
21
|
+
|
22
|
+
2.2.1
|
23
|
+
-----------
|
24
|
+
|
25
|
+
- Message router traps exception when enqueuing Sidekiq job and sends to
|
26
|
+
logger
|
27
|
+
|
1
28
|
2.2.0
|
2
29
|
-----------
|
3
30
|
|
data/Gemfile.lock
CHANGED
@@ -1,69 +1,25 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mantle (2.
|
4
|
+
mantle (2.3.0)
|
5
5
|
redis
|
6
|
-
sidekiq
|
6
|
+
sidekiq (~> 5.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
celluloid (0.17.1.2)
|
12
|
-
bundler
|
13
|
-
celluloid-essentials
|
14
|
-
celluloid-extras
|
15
|
-
celluloid-fsm
|
16
|
-
celluloid-pool
|
17
|
-
celluloid-supervision
|
18
|
-
dotenv
|
19
|
-
nenv
|
20
|
-
rspec-logsplit (>= 0.1.2)
|
21
|
-
timers (>= 4.1.1)
|
22
|
-
celluloid-essentials (0.20.2.1)
|
23
|
-
bundler
|
24
|
-
dotenv
|
25
|
-
nenv
|
26
|
-
rspec-logsplit (>= 0.1.2)
|
27
|
-
timers (>= 4.1.1)
|
28
|
-
celluloid-extras (0.20.1)
|
29
|
-
bundler
|
30
|
-
dotenv
|
31
|
-
nenv
|
32
|
-
rspec-logsplit (>= 0.1.2)
|
33
|
-
timers (>= 4.1.1)
|
34
|
-
celluloid-fsm (0.20.1)
|
35
|
-
bundler
|
36
|
-
dotenv
|
37
|
-
nenv
|
38
|
-
rspec-logsplit (>= 0.1.2)
|
39
|
-
timers (>= 4.1.1)
|
40
|
-
celluloid-pool (0.20.1)
|
41
|
-
bundler
|
42
|
-
dotenv
|
43
|
-
nenv
|
44
|
-
rspec-logsplit (>= 0.1.2)
|
45
|
-
timers (>= 4.1.1)
|
46
|
-
celluloid-supervision (0.20.1.1)
|
47
|
-
bundler
|
48
|
-
dotenv
|
49
|
-
nenv
|
50
|
-
rspec-logsplit (>= 0.1.2)
|
51
|
-
timers (>= 4.1.1)
|
52
11
|
coderay (1.1.0)
|
53
|
-
connection_pool (2.2.
|
12
|
+
connection_pool (2.2.2)
|
54
13
|
diff-lcs (1.2.5)
|
55
|
-
dotenv (2.0.2)
|
56
|
-
hitimes (1.2.3)
|
57
|
-
json (1.8.3)
|
58
14
|
method_source (0.8.2)
|
59
|
-
nenv (0.2.0)
|
60
15
|
pry (0.10.0)
|
61
16
|
coderay (~> 1.1.0)
|
62
17
|
method_source (~> 0.8.1)
|
63
18
|
slop (~> 3.4)
|
64
|
-
|
65
|
-
|
66
|
-
|
19
|
+
rack (2.0.9)
|
20
|
+
rack-protection (2.0.8.1)
|
21
|
+
rack
|
22
|
+
redis (4.1.3)
|
67
23
|
rspec (3.2.0)
|
68
24
|
rspec-core (~> 3.2.0)
|
69
25
|
rspec-expectations (~> 3.2.0)
|
@@ -73,20 +29,16 @@ GEM
|
|
73
29
|
rspec-expectations (3.2.0)
|
74
30
|
diff-lcs (>= 1.2.0, < 2.0)
|
75
31
|
rspec-support (~> 3.2.0)
|
76
|
-
rspec-logsplit (0.1.3)
|
77
32
|
rspec-mocks (3.2.0)
|
78
33
|
diff-lcs (>= 1.2.0, < 2.0)
|
79
34
|
rspec-support (~> 3.2.0)
|
80
35
|
rspec-support (3.2.2)
|
81
|
-
sidekiq (
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
redis (
|
86
|
-
redis-namespace (~> 1.5, >= 1.5.2)
|
36
|
+
sidekiq (5.2.8)
|
37
|
+
connection_pool (~> 2.2, >= 2.2.2)
|
38
|
+
rack (< 2.1.0)
|
39
|
+
rack-protection (>= 1.5.0)
|
40
|
+
redis (>= 3.3.5, < 5)
|
87
41
|
slop (3.5.0)
|
88
|
-
timers (4.1.1)
|
89
|
-
hitimes
|
90
42
|
|
91
43
|
PLATFORMS
|
92
44
|
ruby
|
@@ -97,4 +49,4 @@ DEPENDENCIES
|
|
97
49
|
rspec
|
98
50
|
|
99
51
|
BUNDLED WITH
|
100
|
-
1.
|
52
|
+
2.1.4
|
data/bin/mantle
CHANGED
data/lib/mantle/configuration.rb
CHANGED
data/lib/mantle/message.rb
CHANGED
@@ -10,6 +10,7 @@ module Mantle
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def publish(message)
|
13
|
+
message = message.merge(__MANTLE__: { message_source: whoami }) if whoami
|
13
14
|
message_bus.publish(channel, message)
|
14
15
|
catch_up.add_message(channel, message)
|
15
16
|
end
|
@@ -17,5 +18,9 @@ module Mantle
|
|
17
18
|
private
|
18
19
|
|
19
20
|
attr_reader :message_bus, :catch_up
|
21
|
+
|
22
|
+
def whoami
|
23
|
+
Mantle.configuration.whoami
|
24
|
+
end
|
20
25
|
end
|
21
26
|
end
|
@@ -10,7 +10,16 @@ module Mantle
|
|
10
10
|
Mantle.logger.debug("Routing message for #{@channel}")
|
11
11
|
Mantle.logger.debug("Message: #{@message}")
|
12
12
|
|
13
|
-
|
13
|
+
begin
|
14
|
+
Mantle::Workers::ProcessWorker.perform_async(@channel, @message)
|
15
|
+
rescue => e
|
16
|
+
msg = "Unable to process Mantle message\n"
|
17
|
+
msg += "#{e.class} #{e}\n"
|
18
|
+
msg += "#{e.backtrace.nil? ? '' : e.backtrace.join("\n")}\n"
|
19
|
+
msg += "Channel => #{@channel}\n"
|
20
|
+
msg += "Message => #{@message}\n"
|
21
|
+
Mantle.logger.error msg
|
22
|
+
end
|
14
23
|
end
|
15
24
|
end
|
16
25
|
end
|
data/lib/mantle/version.rb
CHANGED
data/mantle.gemspec
CHANGED
@@ -6,8 +6,8 @@ require 'mantle/version'
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
7
|
gem.name = "mantle"
|
8
8
|
gem.version = Mantle::VERSION
|
9
|
-
gem.authors = ["Grant Ammons", "Brandon Hilkert"]
|
10
|
-
gem.email = ["gammons@gmail.com", "brandonhilkert@gmail.com"]
|
9
|
+
gem.authors = ["Grant Ammons", "Brandon Hilkert", "Scott Gibson", "Frank Hmeidan"]
|
10
|
+
gem.email = ["gammons@gmail.com", "brandonhilkert@gmail.com", "sevgibson@gmail.com", "frank.hmeidan@gmail.com"]
|
11
11
|
gem.description = %q{Ruby application message bus subscriptions with Sidekiq and Redis Pubsub.}
|
12
12
|
gem.summary = %q{Ruby application message bus subscriptions with Sidekiq and Redis Pubsub.}
|
13
13
|
gem.homepage = "https://github.com/PipelineDeals/mantle"
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
|
20
20
|
gem.add_dependency('redis')
|
21
|
-
gem.add_dependency('sidekiq')
|
21
|
+
gem.add_dependency('sidekiq', '~> 5.0')
|
22
22
|
|
23
23
|
gem.add_development_dependency('rspec')
|
24
24
|
gem.add_development_dependency('pry')
|
@@ -14,6 +14,12 @@ describe Mantle::Configuration do
|
|
14
14
|
expect(config.message_handlers).to eq({'a_channel' => 'FakeHandler'})
|
15
15
|
end
|
16
16
|
|
17
|
+
it 'can set/get whoami' do
|
18
|
+
config = Mantle::Configuration.new
|
19
|
+
config.whoami = 'SantaClaus'
|
20
|
+
expect(config.whoami).to eq('SantaClaus')
|
21
|
+
end
|
22
|
+
|
17
23
|
it 'configures default message handler' do
|
18
24
|
config = Mantle::Configuration.new
|
19
25
|
expect(config.message_handlers).to be_instance_of(Mantle::MessageHandlers)
|
@@ -57,5 +57,16 @@ describe Mantle::MessageRouter do
|
|
57
57
|
expect(args.last).to eq(message)
|
58
58
|
end
|
59
59
|
end
|
60
|
+
|
61
|
+
context "processing malformed messages" do
|
62
|
+
it "logs to error log" do
|
63
|
+
fake_process_worker = Class.new
|
64
|
+
stub_const("Mantle::Workers::ProcessWorker", fake_process_worker)
|
65
|
+
allow(fake_process_worker).to receive(:perform_async) { raise JSON::GeneratorError }
|
66
|
+
|
67
|
+
expect(Mantle.logger).to receive(:error)
|
68
|
+
Mantle::MessageRouter.new("user:login", message).route
|
69
|
+
end
|
70
|
+
end
|
60
71
|
end
|
61
72
|
end
|
@@ -12,12 +12,34 @@ describe Mantle::Message do
|
|
12
12
|
mantle_message.message_bus = bus
|
13
13
|
mantle_message.catch_up = catch_up
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
allow(bus).to receive(:publish)
|
16
|
+
allow(catch_up).to receive(:add_message)
|
17
17
|
|
18
18
|
mantle_message.publish(message)
|
19
|
+
|
20
|
+
expect(bus).to have_received(:publish).with(channel, message)
|
21
|
+
expect(catch_up).to have_received(:add_message).with(channel, message)
|
19
22
|
end
|
20
|
-
end
|
21
|
-
end
|
22
23
|
|
24
|
+
it "published message includes message_source" do
|
25
|
+
Mantle.configure { |config| config.whoami = 'SantaClaus' }
|
26
|
+
bus = double("message bus")
|
27
|
+
catch_up = double("catch up")
|
28
|
+
channel = "create:person"
|
29
|
+
message = { id: 1 }
|
30
|
+
actual_message = message.merge(__MANTLE__: { message_source: 'SantaClaus' })
|
23
31
|
|
32
|
+
mantle_message = Mantle::Message.new(channel)
|
33
|
+
mantle_message.message_bus = bus
|
34
|
+
mantle_message.catch_up = catch_up
|
35
|
+
|
36
|
+
allow(bus).to receive(:publish)
|
37
|
+
allow(catch_up).to receive(:add_message)
|
38
|
+
|
39
|
+
mantle_message.publish(message)
|
40
|
+
|
41
|
+
expect(bus).to have_received(:publish).with(channel, actual_message)
|
42
|
+
expect(catch_up).to have_received(:add_message).with(channel, actual_message)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mantle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grant Ammons
|
8
8
|
- Brandon Hilkert
|
9
|
+
- Scott Gibson
|
10
|
+
- Frank Hmeidan
|
9
11
|
autorequire:
|
10
12
|
bindir: bin
|
11
13
|
cert_chain: []
|
12
|
-
date:
|
14
|
+
date: 2020-05-28 00:00:00.000000000 Z
|
13
15
|
dependencies:
|
14
16
|
- !ruby/object:Gem::Dependency
|
15
17
|
name: redis
|
@@ -29,16 +31,16 @@ dependencies:
|
|
29
31
|
name: sidekiq
|
30
32
|
requirement: !ruby/object:Gem::Requirement
|
31
33
|
requirements:
|
32
|
-
- - "
|
34
|
+
- - "~>"
|
33
35
|
- !ruby/object:Gem::Version
|
34
|
-
version: '0'
|
36
|
+
version: '5.0'
|
35
37
|
type: :runtime
|
36
38
|
prerelease: false
|
37
39
|
version_requirements: !ruby/object:Gem::Requirement
|
38
40
|
requirements:
|
39
|
-
- - "
|
41
|
+
- - "~>"
|
40
42
|
- !ruby/object:Gem::Version
|
41
|
-
version: '0'
|
43
|
+
version: '5.0'
|
42
44
|
- !ruby/object:Gem::Dependency
|
43
45
|
name: rspec
|
44
46
|
requirement: !ruby/object:Gem::Requirement
|
@@ -71,6 +73,8 @@ description: Ruby application message bus subscriptions with Sidekiq and Redis P
|
|
71
73
|
email:
|
72
74
|
- gammons@gmail.com
|
73
75
|
- brandonhilkert@gmail.com
|
76
|
+
- sevgibson@gmail.com
|
77
|
+
- frank.hmeidan@gmail.com
|
74
78
|
executables:
|
75
79
|
- mantle
|
76
80
|
extensions: []
|
@@ -158,4 +162,3 @@ test_files:
|
|
158
162
|
- spec/lib/mantle/workers/process_worker_spec.rb
|
159
163
|
- spec/lib/mantle_spec.rb
|
160
164
|
- spec/spec_helper.rb
|
161
|
-
has_rdoc:
|