class Sumac::Shutdown

Public Class Methods

new(connection) click to toggle source
# File lib/sumac/shutdown.rb, line 4
def initialize(connection)
  raise "argument 'connection' must be a Connection" unless connection.is_a?(Connection)
  @connection = connection
end

Public Instance Methods

receive(exchange) click to toggle source
# File lib/sumac/shutdown.rb, line 25
def receive(exchange)
  raise MessageError unless exchange.is_a?(Message::Exchange::ShutdownNotification)
  @connection.to(:shutdown)
  nil
end
send_notification() click to toggle source

def initiated? @orchestrator.state_machine.at?([:initiate_shutdown, :shutdown, :close]) end

# File lib/sumac/shutdown.rb, line 19
def send_notification
  message = Message::Exchange::ShutdownNotification.new(@connection)
  @connection.messenger.send(message)
  nil
end