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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d7666c410d9615fbc6485721b8a58fa9955bbae59e0b4398998ea8ebcaaea2cf
4
- data.tar.gz: 2047edef3c30faa65b313f7000676a1d15bc7a4738e732582f9bde56852d5c2e
3
+ metadata.gz: 0c2f57cbd2f228dd7ff9fccb5184cfb5bbe2809437735756bec1235b4824970b
4
+ data.tar.gz: f5ac7c349e03e3892677d474e384359fafae2bb7596a632c063924b973699ca8
5
5
  SHA512:
6
- metadata.gz: b2f35e80e2ffdd4b8159732ebfbd543cb597b03fc9569da9c5aab26fac05bf216c150b427e902e448da56c96e2eb3feb7e76e5b9d73e370decb9a3eb0bb067b6
7
- data.tar.gz: 4f73eae45aaaa94b2ca1fc9443028c49e20bbc7ccc96e3913e36593176b8c1088d53e85a11d97ab89ea240f317c0efc47bfa5bdbab93cc70e423f6bf14b20258
6
+ metadata.gz: e16f90031892e086bbc8d1b9bbadc22d85735eefb89b018810e48ba6a72207f796e0c3d4e6a2adc4492bf682797b6b9ea37c685f2eb7d1a72966879789775853
7
+ data.tar.gz: f5d90c22115ccea63d16729b49e39cb68ff8de6ca73b0ce6586366db1ac07c185e3fcff87dd08ddc5e4bf197b01535c55d2708d53280a24b379c0fbad86c352c
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- messaging (3.5.4)
4
+ messaging (3.5.5)
5
5
  activerecord
6
6
  activesupport
7
7
  after_transaction
@@ -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
- # define stream_name in your message class to override
92
- nil
117
+ return unless self.class.stream_name
118
+ instance_exec(&self.class.stream_name)
93
119
  end
94
120
 
95
121
  def stream_category
@@ -1,3 +1,3 @@
1
1
  module Messaging
2
- VERSION = '3.5.4'.freeze
2
+ VERSION = '3.5.5'.freeze
3
3
  end
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
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-05-27 00:00:00.000000000 Z
11
+ date: 2020-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord