Class: Smith::Commands::Rm

Inherits:
Smith::CommandBase show all
Defined in:
lib/smith/commands/smithctl/rm.rb

Instance Attribute Summary

Attributes inherited from Smith::CommandBase

#options, #target

Instance Method Summary collapse

Methods inherited from Smith::CommandBase

#banner, #format_help, #initialize, #parse_options

Methods included from Logger

included

Constructor Details

This class inherits a constructor from Smith::CommandBase

Instance Method Details

#executeObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/smith/commands/smithctl/rm.rb', line 5

def execute
  case target.size
  when 0
    responder.succeed("No queue specified. Please specify a queue.")
  else
    worker = ->(queue_name, iter) do
      delete_queue(queue_name) do |delete_ok|
        delete_exchange(queue_name, &iter)
      end
    end

    # FIXME: Return errors to the caller rather than doing nothing or logging errors
    done = -> { responder.succeed }

    EM::Iterator.new(target).each(worker, done)
  end
end