Class: Mammoth::DeadLetterCommands
- Inherits:
-
Object
- Object
- Mammoth::DeadLetterCommands
- 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
-
#argv ⇒ Object
readonly
Returns the value of attribute argv.
-
#lifecycle_hooks ⇒ Object
readonly
Returns the value of attribute lifecycle_hooks.
Class Method Summary collapse
Instance Method Summary collapse
-
#call ⇒ Integer
Dispatch the nested dead-letter subcommand.
-
#initialize(argv, lifecycle_hooks: LifecycleHooks.new) ⇒ DeadLetterCommands
constructor
A new instance of DeadLetterCommands.
Constructor Details
#initialize(argv, lifecycle_hooks: LifecycleHooks.new) ⇒ DeadLetterCommands
Returns a new instance of DeadLetterCommands.
29 30 31 32 |
# File 'lib/mammoth/dead_letter_commands.rb', line 29 def initialize(argv, lifecycle_hooks: LifecycleHooks.new) @argv = argv @lifecycle_hooks = lifecycle_hooks.is_a?(LifecycleHooks) ? lifecycle_hooks : LifecycleHooks.new(lifecycle_hooks) end |
Instance Attribute Details
#argv ⇒ Object (readonly)
Returns the value of attribute argv.
20 21 22 |
# File 'lib/mammoth/dead_letter_commands.rb', line 20 def argv @argv end |
#lifecycle_hooks ⇒ Object (readonly)
Returns the value of attribute lifecycle_hooks.
20 21 22 |
# File 'lib/mammoth/dead_letter_commands.rb', line 20 def lifecycle_hooks @lifecycle_hooks end |
Class Method Details
.call(argv, lifecycle_hooks: LifecycleHooks.new) ⇒ Object
23 24 25 |
# File 'lib/mammoth/dead_letter_commands.rb', line 23 def self.call(argv, lifecycle_hooks: LifecycleHooks.new) new(argv, lifecycle_hooks: lifecycle_hooks).call end |
Instance Method Details
#call ⇒ Integer
Dispatch the nested dead-letter subcommand.
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/mammoth/dead_letter_commands.rb', line 37 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. 1 end |