Class: EventStoreClient::Broker
- Inherits:
-
Object
- Object
- EventStoreClient::Broker
- Includes:
- Configuration
- Defined in:
- lib/event_store_client/broker.rb
Instance Method Summary collapse
-
#call(subscriptions, wait: false) ⇒ Object
Distributes known subscriptions to multiple threads.
Methods included from Configuration
Instance Method Details
#call(subscriptions, wait: false) ⇒ Object
Distributes known subscriptions to multiple threads
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/event_store_client/broker.rb', line 12 def call(subscriptions, wait: false) subscriptions.each do |subscription| threads << Thread.new do connection.listen(subscription, options: { interval: 1, count: 10 }) do |event| subscription.subscriber.call(event) end end end threads.each(&:join) if wait end |