messaging 3.5.4 → 3.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/messaging/message.rb +28 -2
- data/lib/messaging/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c2f57cbd2f228dd7ff9fccb5184cfb5bbe2809437735756bec1235b4824970b
|
4
|
+
data.tar.gz: f5ac7c349e03e3892677d474e384359fafae2bb7596a632c063924b973699ca8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e16f90031892e086bbc8d1b9bbadc22d85735eefb89b018810e48ba6a72207f796e0c3d4e6a2adc4492bf682797b6b9ea37c685f2eb7d1a72966879789775853
|
7
|
+
data.tar.gz: f5d90c22115ccea63d16729b49e39cb68ff8de6ca73b0ce6586366db1ac07c185e3fcff87dd08ddc5e4bf197b01535c55d2708d53280a24b379c0fbad86c352c
|
data/Gemfile.lock
CHANGED
data/lib/messaging/message.rb
CHANGED
@@ -25,6 +25,32 @@ module Messaging
|
|
25
25
|
end
|
26
26
|
|
27
27
|
module ClassMethods
|
28
|
+
# The stream that the message will be stored in when published.
|
29
|
+
#
|
30
|
+
# Stream names consists of the stream category and the stream id separated by a $.
|
31
|
+
# For instance "customer$123" where "customer" is the category and "123" is the id.
|
32
|
+
#
|
33
|
+
# When no stream name is given the message will not be persisted in the message store.
|
34
|
+
#
|
35
|
+
# @param [#call,String,nil] name The name of the stream, will be evaluated in the context
|
36
|
+
# of the message instance.
|
37
|
+
#
|
38
|
+
# @example
|
39
|
+
# class CustomerRegistered
|
40
|
+
# include Messaging::Message
|
41
|
+
#
|
42
|
+
# stream_name -> { "customer$#{customer_id}"}
|
43
|
+
#
|
44
|
+
# attribute :customer_id, Integer
|
45
|
+
# end
|
46
|
+
#
|
47
|
+
# CustomerRegistered.new(customer_id: 123).stream_name
|
48
|
+
# # => "customer$123"
|
49
|
+
def stream_name(name = nil)
|
50
|
+
return @stream_name unless name
|
51
|
+
@stream_name = name
|
52
|
+
end
|
53
|
+
|
28
54
|
# By default the topic is the same as the name of the message.
|
29
55
|
# We change the / that would be set for a namespaced message as "/" isn't valid in a topic
|
30
56
|
# To change the topic for a message just set it to whatever you want in your class definition.
|
@@ -88,8 +114,8 @@ module Messaging
|
|
88
114
|
end
|
89
115
|
|
90
116
|
def stream_name
|
91
|
-
|
92
|
-
|
117
|
+
return unless self.class.stream_name
|
118
|
+
instance_exec(&self.class.stream_name)
|
93
119
|
end
|
94
120
|
|
95
121
|
def stream_category
|
data/lib/messaging/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: messaging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.
|
4
|
+
version: 3.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bukowskis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|