Class: Warren::App::Consumer

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/warren/app/consumer.rb

Overview

Warren Thor CLI subcommand used to:

  • Add new consumer configurations

  • Start consumers

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Ensure we exit with an error in the event of failure

Returns:

  • (Boolean)


20
21
22
# File 'lib/warren/app/consumer.rb', line 20

def self.exit_on_failure?
  true
end

Instance Method Details

#add(name = nil) ⇒ Void

Invoked by ‘$ warren consumer add` adds a consumer to the `warren_consumers.yml`

Parameters:

  • name (String, nil) (defaults to: nil)

    Optional: Passed in from Command. The name of the consumer to create.

Returns:

  • (Void)


43
44
45
46
# File 'lib/warren/app/consumer.rb', line 43

def add(name = nil)
  say 'Adding a consumer'
  Warren::App::ConsumerAdd.invoke(self, name, options)
end

#startVoid

Invoked by ‘$ warren consumer start`. Starts up the configured consumers

Returns:

  • (Void)


59
60
61
62
# File 'lib/warren/app/consumer.rb', line 59

def start
  say 'Starting consumers'
  Warren::App::ConsumerStart.invoke(self, options)
end