startback 0.17.1 → 0.17.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/startback/event/agent.rb +16 -1
- data/lib/startback/event/engine.rb +2 -2
- data/lib/startback/event/ext/operation.rb +2 -0
- data/lib/startback/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: 47e8ac3b588f01947b8f6850a40ae2777bf3578b8fea2c38d923f9619f7ddf0e
|
4
|
+
data.tar.gz: d09a7168a291df2a59b199be072969fad30a1c7ef33d6c78058dfb358fbafd5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dddbf9e33df9565c4ec445d107e9decc83c23a7538aba0eac4babd5104c0000ad89a49d657060ac400a9e79418e1c705c2dfb4b3b620b530e932f04977ce98f0
|
7
|
+
data.tar.gz: 6fe5a230ac86dc2cd2b8bee70b54df7c3be840f9afd8d871d54d1a31cffa3a1b10bccc0de003201f169436a96b14b32bcd58f2a6aaffddd4a0d67b4a132398db
|
@@ -14,9 +14,10 @@ module Startback
|
|
14
14
|
include Support::OperationRunner
|
15
15
|
include Support::Robustness
|
16
16
|
|
17
|
-
def initialize(engine)
|
17
|
+
def initialize(engine, type = :all)
|
18
18
|
@engine = engine
|
19
19
|
@context = nil
|
20
|
+
@type = type
|
20
21
|
install_listeners
|
21
22
|
end
|
22
23
|
attr_reader :engine
|
@@ -41,6 +42,8 @@ module Startback
|
|
41
42
|
#
|
42
43
|
# See Bus#listen
|
43
44
|
def async(exchange, queue)
|
45
|
+
return unless async?
|
46
|
+
|
44
47
|
bus.async.listen(exchange, queue) do |event_data|
|
45
48
|
event = engine.factor_event(event_data)
|
46
49
|
with_context(event.context).call(event)
|
@@ -51,6 +54,8 @@ module Startback
|
|
51
54
|
#
|
52
55
|
# See Bus#listen
|
53
56
|
def sync(exchange, queue)
|
57
|
+
return unless sync?
|
58
|
+
|
54
59
|
bus.listen(exchange, queue) do |event_data|
|
55
60
|
event = engine.factor_event(event_data)
|
56
61
|
with_context(event.context).call(event)
|
@@ -79,6 +84,16 @@ module Startback
|
|
79
84
|
super(op).merge(context: context)
|
80
85
|
end
|
81
86
|
|
87
|
+
private
|
88
|
+
|
89
|
+
def async?
|
90
|
+
@type == :async || @type == :all
|
91
|
+
end
|
92
|
+
|
93
|
+
def sync?
|
94
|
+
@type == :sync || @type == :all
|
95
|
+
end
|
96
|
+
|
82
97
|
end # class Agent
|
83
98
|
end # class Event
|
84
99
|
end # module Starback
|
@@ -62,13 +62,13 @@ module Startback
|
|
62
62
|
bus.connect
|
63
63
|
end
|
64
64
|
|
65
|
-
def create_agents
|
65
|
+
def create_agents(type = :all)
|
66
66
|
return unless parent = self.class.auto_create_agents
|
67
67
|
|
68
68
|
ObjectSpace
|
69
69
|
.each_object(Class)
|
70
70
|
.select { |klass| klass <= parent }
|
71
|
-
.each { |klass| klass.new(self) }
|
71
|
+
.each { |klass| klass.new(self, type) }
|
72
72
|
end
|
73
73
|
|
74
74
|
def factor_event(event_data)
|
data/lib/startback/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: startback
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.17.
|
4
|
+
version: 0.17.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bernard Lambeau
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|