nexus_domain_events 0.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nexus_domain_events.rb +1 -0
- data/lib/nexus_domain_events/bus.rb +26 -0
- data/lib/nexus_domain_events/event.rb +1 -1
- data/lib/nexus_domain_events/version.rb +1 -1
- data/nexus_domain_events.gemspec +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09ee1d8a1cf68e5c60d8c25c5207a3d9162cf395e4adfa88d71d0a7dda59fcb6'
|
4
|
+
data.tar.gz: c767b8c7442f51345e205d4880dfc1f4f2500186a0fa292f098b51c93372f813
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d144b45f1e6bb3abf62d1c99cbbeb906955352c9b283fd28534e4f17e0920f911d92e3f111f8bdc5ab6262651318508879c8fd2b1837a59e7b7b092b21fa3a47
|
7
|
+
data.tar.gz: 3f7828176eaa5261c9b55e51de4a31281d93a4ab41e8ec60a1c0d0c4f32a7cbf829e7faaeddce4595aaec829ec9433884c66e4803347d8ee849ac40dfd53758e
|
data/lib/nexus_domain_events.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NexusDomainEvents
|
4
|
+
# A domain events bus for dispatching events to
|
5
|
+
class Bus
|
6
|
+
def initialize(topic: nil)
|
7
|
+
@topic = topic || default_topic
|
8
|
+
end
|
9
|
+
|
10
|
+
# @param [Event] domain_event
|
11
|
+
def dispatch(domain_event)
|
12
|
+
@topic.publish(
|
13
|
+
domain_event.to_json,
|
14
|
+
routing_key: domain_event.message_name
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def default_topic
|
21
|
+
conn = Bunny.new(ENV['AMQP_CONNECTION']).start
|
22
|
+
channel = conn.create_channel
|
23
|
+
channel.topic('domain_events', durable: true)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/nexus_domain_events.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.email = ['chris.harrison@nexusmods.com']
|
9
9
|
|
10
10
|
spec.summary = 'Ruby based domain eventing tools'
|
11
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 2.
|
11
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.6.0')
|
12
12
|
|
13
13
|
# Specify which files should be added to the gem when it is released.
|
14
14
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nexus_domain_events
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Harrison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -38,6 +38,7 @@ files:
|
|
38
38
|
- Gemfile
|
39
39
|
- README.md
|
40
40
|
- lib/nexus_domain_events.rb
|
41
|
+
- lib/nexus_domain_events/bus.rb
|
41
42
|
- lib/nexus_domain_events/event.rb
|
42
43
|
- lib/nexus_domain_events/version.rb
|
43
44
|
- nexus_domain_events.gemspec
|
@@ -52,7 +53,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
52
53
|
requirements:
|
53
54
|
- - ">="
|
54
55
|
- !ruby/object:Gem::Version
|
55
|
-
version: 2.
|
56
|
+
version: 2.6.0
|
56
57
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
58
|
requirements:
|
58
59
|
- - ">="
|