evt-consumer 0.2.0.2 → 0.2.1.0

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
  SHA1:
3
- metadata.gz: 68ec0dc418431484fe90c48904fd9035945a1e3a
4
- data.tar.gz: 0ff7f4336263b707f7ad708efe14cfcf77e35703
3
+ metadata.gz: 2d8a67363fe73b9f14487853b768ae7c7517a8cf
4
+ data.tar.gz: 186fe59a8acbbf419b705b88a343fd87e07a84e4
5
5
  SHA512:
6
- metadata.gz: c669c8fd9b42a44ad326a414ec1e0910d34f17e6932c1a77335ac6802485e9e5ad16453d74061a08acb4d0a4acd860adad52883d3151771ea6d248644f918e17
7
- data.tar.gz: 7e290bcd01c37d908f2ddf5064f27cabb602b15f1424fb8b3b7d3d7d96d7dc44c9639da57d4ac74e42d494613680b4980f6b43239855df03444ae9a82ece78ed
6
+ metadata.gz: 49ac045f2b5f46c4d4ced49a8fb7cab179be64efb2bedf80502d4a175d6b6ef3dd2f80bd25f5e51704cbc963c9f2fddbecd61a39f0e4e857c6584e82be5cf78c
7
+ data.tar.gz: 50fc32c50bf55ea29a308afcc3c15e46239396d151a7717e53ad2d636c99e1ca5b3ef108adfd252f06d4887063ff47e5244353276d7c221e7c58817024e46a84
@@ -4,6 +4,7 @@ module Consumer
4
4
  include Log::Dependency
5
5
 
6
6
  extend Build
7
+ extend Run
7
8
  extend Start
8
9
 
9
10
  extend HandleMacro
@@ -106,15 +107,44 @@ module Consumer
106
107
  end
107
108
  end
108
109
 
110
+ module Run
111
+ def run(stream_name, **arguments, &action)
112
+ consumer, threads, addresses = nil
113
+
114
+ return_value = start stream_name, **arguments do |_consumer, _threads, _addresses|
115
+ consumer = _consumer
116
+ threads = _threads
117
+ addresses = _addresses
118
+ end
119
+
120
+ loop do
121
+ action.(consumer, threads, addresses) if action
122
+ consumer.subscription.cycle { nil }
123
+ end
124
+
125
+ addresses.each do |address|
126
+ Actor::Messaging::Send.(:stop, address)
127
+ end
128
+
129
+ threads.each &:join
130
+
131
+ return_value
132
+ end
133
+ end
134
+
109
135
  module Start
110
136
  def start(stream_name, **arguments, &probe)
111
137
  instance = build stream_name, **arguments
112
138
 
113
139
  _, subscription_thread = ::Actor::Start.(instance.subscription)
114
140
 
115
- actor_address = Actor.start instance, instance.subscription
141
+ actor_address, actor_thread = Actor.start instance, instance.subscription, include: :thread
142
+
143
+ if probe
144
+ subscription_address = instance.subscription.address
116
145
 
117
- probe.(instance, actor_address) if probe
146
+ probe.(instance, [actor_thread, subscription_thread], [actor_address, subscription_address])
147
+ end
118
148
 
119
149
  AsyncInvocation::Incorrect
120
150
  end
@@ -18,4 +18,4 @@ require 'consumer/controls/position_store/local_file'
18
18
  require 'consumer/controls/subscription'
19
19
 
20
20
  require 'consumer/controls/consumer'
21
- require 'consumer/controls/consumer/incrementing'
21
+ require 'consumer/controls/consumer/logs_events'
@@ -1,7 +1,7 @@
1
1
  module Consumer
2
2
  module Controls
3
3
  module Consumer
4
- class Incrementing
4
+ class LogsEvents
5
5
  include ::Consumer
6
6
 
7
7
  def self.logger
@@ -18,7 +18,7 @@ module Consumer
18
18
 
19
19
  position_store PositionStore::LocalFile, update_interval: 10
20
20
 
21
- def configure(session: nil)
21
+ def configure(session: nil, batch_size: nil)
22
22
  sleep_duration = ENV['SLEEP_DURATION'] || 100
23
23
  sleep_duration = sleep_duration.to_i
24
24
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evt-consumer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.2
4
+ version: 0.2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Eventide Project
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-22 00:00:00.000000000 Z
11
+ date: 2017-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ntl-actor
@@ -78,7 +78,7 @@ files:
78
78
  - lib/consumer/controls.rb
79
79
  - lib/consumer/controls/category.rb
80
80
  - lib/consumer/controls/consumer.rb
81
- - lib/consumer/controls/consumer/incrementing.rb
81
+ - lib/consumer/controls/consumer/logs_events.rb
82
82
  - lib/consumer/controls/cycle.rb
83
83
  - lib/consumer/controls/error.rb
84
84
  - lib/consumer/controls/event_data.rb