Class: EventStoreClient::Broker

Inherits:
Object
  • Object
show all
Defined in:
lib/event_store_client/broker.rb

Instance Method Summary collapse

Instance Method Details

#call(subscriptions) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/event_store_client/broker.rb', line 5

def call(subscriptions)
  subscriptions.each do |subscription|
    new_events = connection.consume_feed(subscription.stream, subscription.name)
    next if new_events.none?
    new_events.each do |event|
      subscription.subscribers.each do |subscriber|
        subscriber.call(event)
      end
    end
  end
end