Sha256: 2c4f323b5db9e7ba7403482afda612c1c08fd3547e96e7faf5f98124e9186572

Contents?: true

Size: 871 Bytes

Versions: 9

Compression:

Stored size: 871 Bytes

Contents

require 'asir/transport/composite'

module ASIR
  class Transport
    # !SLIDE
    # Broadcast Transport
    #
    # Broadcast to multiple Transports.
    class Broadcast < self
      include Composite

      def _send_message state
        result = first_exception = nil
        transports.each do | transport |
          begin
            result = transport.send_message(state.message)
          rescue *Error::Unrecoverable.modules
            raise
          rescue ::Exception => exc
            first_exception ||= exc
            _handle_send_message_exception! transport, state, exc
            raise exc unless @continue_on_exception
          end
        end
        if first_exception && @reraise_first_exception
          raise first_exception
        end
        state.result = Result.new(state.message, result)
      end
    end
    # !SLIDE END
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
asir-1.2.11 lib/asir/transport/broadcast.rb
asir-1.2.10 lib/asir/transport/broadcast.rb
asir-1.2.9 lib/asir/transport/broadcast.rb
asir-1.2.8 lib/asir/transport/broadcast.rb
asir-1.2.7 lib/asir/transport/broadcast.rb
asir-1.2.6 lib/asir/transport/broadcast.rb
asir-1.2.5 lib/asir/transport/broadcast.rb
asir-1.2.3 lib/asir/transport/broadcast.rb
asir-1.2.2 lib/asir/transport/broadcast.rb