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.



784
785
786
787
# File 'lib/march_hare/session.rb', line 784

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

Class Method Details

.for_finish(block) ⇒ Object



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

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

.for_start(block) ⇒ Object



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

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

Instance Method Details

#handle_recovery(recoverable) ⇒ Object



793
794
795
# File 'lib/march_hare/session.rb', line 793

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

#handle_recovery_started(recoverable) ⇒ Object



789
790
791
# File 'lib/march_hare/session.rb', line 789

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