messaging 3.5.1 → 3.5.2
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.rb +11 -0
- data/lib/messaging/adapters.rb +2 -0
- data/lib/messaging/routing.rb +28 -2
- data/lib/messaging/routing/route.rb +2 -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: 061aaa840e0dbe849dec6ce3f8fb8d7747c4f2f507684bfc2999c0d1079ee1d3
|
4
|
+
data.tar.gz: 5ac1afb9efc65d3a7d73c4cbebb0f65379a01ea4bf69b9b0520bb4bd393a7d7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c0f7ecae61ab6561785ef3d193a6e0f1337c1caab25d063205e4d8d5b84086737f6cf27a21f25a3dd20c12bb584abaad02558cfbd90f67cf63d9d2c5ea1f132
|
7
|
+
data.tar.gz: 4a18c65d9d8388685c5b39932e9829cb30427b0c3156a31992bbc6dd559b16a12e47e2e5998538e1b36cd194a20c31a52e0dd1cffd6130607ced188c64586082
|
data/Gemfile.lock
CHANGED
data/lib/messaging.rb
CHANGED
@@ -56,6 +56,17 @@ module Messaging
|
|
56
56
|
routes.inline!(&block)
|
57
57
|
end
|
58
58
|
|
59
|
+
def self.without_dispatch(&block)
|
60
|
+
current_dispatcher = Config.dispatcher.adapter
|
61
|
+
Config.dispatcher.adapter = :null_adapter
|
62
|
+
|
63
|
+
result = block.call
|
64
|
+
|
65
|
+
ensure
|
66
|
+
Config.dispatcher.adapter = current_dispatcher
|
67
|
+
result
|
68
|
+
end
|
69
|
+
|
59
70
|
def self.category(name)
|
60
71
|
message_store.category(name)
|
61
72
|
end
|
data/lib/messaging/adapters.rb
CHANGED
data/lib/messaging/routing.rb
CHANGED
@@ -5,6 +5,32 @@ require 'messaging/routing/enqueue_message_handler'
|
|
5
5
|
|
6
6
|
module Messaging
|
7
7
|
module Routing
|
8
|
+
def self.included(base)
|
9
|
+
base.send :extend, ClassMethods
|
10
|
+
end
|
11
|
+
|
12
|
+
module ClassMethods
|
13
|
+
def definitions
|
14
|
+
@definitions ||= []
|
15
|
+
end
|
16
|
+
|
17
|
+
def on(pattern, **options, &block)
|
18
|
+
definitions << { pattern: pattern, options: options, block: block }
|
19
|
+
end
|
20
|
+
|
21
|
+
def new(*args, &block)
|
22
|
+
instance = allocate
|
23
|
+
|
24
|
+
# Pre-initialize
|
25
|
+
definitions.each do |definition|
|
26
|
+
instance.on(definition[:pattern], definition[:options], &definition[:block])
|
27
|
+
end
|
28
|
+
|
29
|
+
instance.send(:initialize, *args, &block)
|
30
|
+
instance
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
8
34
|
# Public: Sets up routes for the events that matches the given pattern
|
9
35
|
#
|
10
36
|
# pattern - Which messages to route. Can be a string, a regexp,
|
@@ -44,8 +70,8 @@ module Messaging
|
|
44
70
|
end
|
45
71
|
|
46
72
|
# Internal: Handles the message with the matching subscribers
|
47
|
-
def handle(message)
|
48
|
-
routes.map { |route| route.call(message) }
|
73
|
+
def handle(message, context = self)
|
74
|
+
routes.map { |route| route.call(message, context) }
|
49
75
|
message
|
50
76
|
end
|
51
77
|
|
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.2
|
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-
|
11
|
+
date: 2020-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|