Class: MarchHare::Session::RecoveryListener

Inherits:
Object
  • Object
show all
Defined in:
lib/march_hare/session.rb

Overview

Ruby blocks-based RecoveryListener that handles connection recovery_started and recovery

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(before_recovery, after_recovery) ⇒ RecoveryListener

Returns a new instance of RecoveryListener.



772
773
774
775
# File 'lib/march_hare/session.rb', line 772

def initialize(before_recovery, after_recovery)
  @recovery_start_hook = before_recovery
  @recovery_hook = after_recovery
end

Class Method Details

.for_finish(block) ⇒ Object



768
769
770
# File 'lib/march_hare/session.rb', line 768

def self.for_finish(block)
  new(NOOP_FN1, block)
end

.for_start(block) ⇒ Object



764
765
766
# File 'lib/march_hare/session.rb', line 764

def self.for_start(block)
  new(block, NOOP_FN1)
end

Instance Method Details

#handle_recovery(recoverable) ⇒ Object



781
782
783
# File 'lib/march_hare/session.rb', line 781

def handle_recovery(recoverable)
  @recovery_hook.call(recoverable)
end

#handle_recovery_started(recoverable) ⇒ Object



777
778
779
# File 'lib/march_hare/session.rb', line 777

def handle_recovery_started(recoverable)
  @recovery_start_hook.call(recoverable)
end