Module: Bones::RPC::Failover

Extended by:
Failover
Included in:
Failover
Defined in:
lib/bones/rpc/failover.rb,
lib/bones/rpc/failover/retry.rb,
lib/bones/rpc/failover/ignore.rb,
lib/bones/rpc/failover/disconnect.rb

Overview

Provides behaviour around failover scenarios for different types of exceptions that get raised on connection and execution of operations.

Since:

  • 2.0.0

Defined Under Namespace

Modules: Disconnect, Ignore, Retry

Constant Summary collapse

STRATEGIES =

Hash lookup for the failover classes based off the exception type.

Since:

  • 2.0.0

{
  Errors::ConnectionFailure => Retry
}.freeze

Instance Method Summary collapse

Instance Method Details

#get(exception) ⇒ Object

Get the appropriate failover handler given the provided exception.

Examples:

Get the failover handler for an IOError.

Bones::RPC::Failover.get(IOError)

Parameters:

  • exception (Exception)

    The raised exception.

Returns:

  • (Object)

    The failover handler.

Since:

  • 2.0.0



33
34
35
# File 'lib/bones/rpc/failover.rb', line 33

def get(exception)
  STRATEGIES.fetch(exception.class, Disconnect)
end