startback 0.17.0 → 0.17.2
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/version.rb +1 -1
- data/lib/startback/web/api.rb +2 -0
- 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: 0d2cd78e89f819311eedaa9dc75d71fdfeff685aa2723d16dd50391077be1061
|
4
|
+
data.tar.gz: 808cc9194bedab39965ddcd3cc31774470335b264dd938803a5f90233b9fea73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfdb0ec227a477d7f543dbb8e615d3f81c453fe6f4f9dc18fc20212e9d0fe476fc1c481b0e1292ff6202e99ae7e99fe670f82113fa7b64e1fa7323e53ba08436
|
7
|
+
data.tar.gz: f5405619b93cb20ef492beeba4b01d857dfc0d6adf77e50ff2517cefef953d57897c4082bf7d46708e85ad9f2048a475833f151dc78fb265f06eae86e0f661bc
|
@@ -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
data/lib/startback/web/api.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.2
|
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
|