lib/event_store_client/broker.rb
def call(subscriptions, wait: false)
      Signal.trap('TERM') do
        Thread.new { logger&.info('Broker: TERM Signal has been received') }
        threads.each do |thread|
          thread.thread_variable_set(:terminate, true)
        end
        Thread.new { logger&.info('Broker: Terminate variable for subscription threads set') }
      end

      subscriptions.each do |subscription|
        threads << Thread.new do
          subscriptions.listen(subscription)
        end
      end
      threads.each(&:join) if wait
    end
# Distributes known subscriptions to multiple threads
# @param [EventStoreClient::Subscriptions]
# @param wait [Boolean] (Optional) Controls if broker should block
#   main app process (useful for debugging)
#
Distributes known subscriptions to multiple threads
Distributes known subscriptions to multiple threads
def call(subscriptions, wait: false)
      Signal.trap('TERM') do
        Thread.new { logger&.info('Broker: TERM Signal has been received') }
        threads.each do |thread|
          thread.thread_variable_set(:terminate, true)
        end
        Thread.new { logger&.info('Broker: Terminate variable for subscription threads set') }
      end
      subscriptions.each do |subscription|
        threads << Thread.new do
          subscriptions.listen(subscription)
        end
      end
      threads.each(&:join) if wait
    end
def call ( subscriptions , wait : false ) Signal . trap ( 'TERM' ) do Thread . new { logger &. info ( 'Broker: TERM Signal has been received' ) } threads . each do | thread | thread . thread_variable_set ( :terminate , true ) end Thread . new { logger &. info ( 'Broker: Terminate variable for subscription threads set' ) } end subscriptions . each do | subscription | threads << Thread . new do subscriptions . listen ( subscription ) end end threads . each ( & :join ) if wait end
Distributes known subscriptions to multiple threads
Distributes known subscriptions to multiple threads
subscriptions
wait
(Optional) Controls if broker should block main app process (useful for debugging)
( Optional ) Controls if broker should block main app process ( useful for debugging )
None