Class: Mammoth::DeadLetterCommands

Inherits:
Object
  • Object
show all
Defined in:
lib/mammoth/dead_letter_commands.rb

Overview

Operator commands for inspecting and replaying dead letters. rubocop:disable Metrics/ClassLength

Defined Under Namespace

Classes: DEAD_LETTER_TRANSACTION_ENVELOPE

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ DeadLetterCommands

Returns a new instance of DeadLetterCommands.

Parameters:

  • argv (Array<String>)

    command line arguments



28
29
30
# File 'lib/mammoth/dead_letter_commands.rb', line 28

def initialize(argv)
  @argv = argv
end

Instance Attribute Details

#argvObject (readonly)

Returns the value of attribute argv.



20
21
22
# File 'lib/mammoth/dead_letter_commands.rb', line 20

def argv
  @argv
end

Class Method Details

.call(argv) ⇒ Object

Parameters:

  • argv (Array<String>)

    command line arguments



23
24
25
# File 'lib/mammoth/dead_letter_commands.rb', line 23

def self.call(argv)
  new(argv).call
end

Instance Method Details

#callInteger

Dispatch the nested dead-letter subcommand.

Returns:

  • (Integer)

    process status code



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/mammoth/dead_letter_commands.rb', line 35

def call
  case command
  when "list" then list
  when "show" then show
  when "replay" then replay
  else
    raise ConfigurationError, "dead-letters subcommand required\n#{CLI::USAGE}"
  end
rescue Mammoth::Error => e
  warn e.message
  1
end