Sha256: 15398bbab04d4e044c40ce5a228da288006f1d80f4c1c51d94de0c00f685b981

Contents?: true

Size: 854 Bytes

Versions: 18

Compression:

Stored size: 854 Bytes

Contents

require 'asir/transport/composite'

module ASIR
  class Transport
    # !SLIDE
    # Fallback Transport
    class Fallback < self
      include Composite

      def _send_message message, message_payload
        result = sent = first_exception = nil
        transports.each do | transport |
          begin
            result = transport.send_message(message)
            sent = true
            break
          rescue ::Exception => exc
            first_exception ||= exc
            _handle_send_message_exception! transport, message, exc
          end
        end
        unless sent
          if first_exception && @reraise_first_exception
            raise first_exception
          end
          raise FallbackError, "fallback failed"
        end
        result
      end
      class FallbackError < Error; end
    end
    # !SLIDE END
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
asir-1.1.12 lib/asir/transport/fallback.rb
asir-1.1.11 lib/asir/transport/fallback.rb
asir-1.1.10 lib/asir/transport/fallback.rb
asir-1.1.9 lib/asir/transport/fallback.rb
asir-1.1.8 lib/asir/transport/fallback.rb
asir-1.1.7 lib/asir/transport/fallback.rb
asir-1.1.6 lib/asir/transport/fallback.rb
asir-1.1.5 lib/asir/transport/fallback.rb
asir-1.1.4 lib/asir/transport/fallback.rb
asir-1.1.3 lib/asir/transport/fallback.rb
asir-1.1.2 lib/asir/transport/fallback.rb
asir-1.1.1 lib/asir/transport/fallback.rb
asir-1.1.0 lib/asir/transport/fallback.rb
asir-1.0.8 lib/asir/transport/fallback.rb
asir-1.0.7 lib/asir/transport/fallback.rb
asir-1.0.6 lib/asir/transport/fallback.rb
asir-1.0.5 lib/asir/transport/fallback.rb
asir-1.0.4 lib/asir/transport/fallback.rb