Class: Falqon::Pro::CLI::Schedule
- Inherits:
-
CLI::Schedule
- Object
- CLI::Schedule
- Falqon::Pro::CLI::Schedule
- Defined in:
- lib/falqon/pro/cli/schedule.rb
Overview
Schedule a message for retry
This command moves a messages from the scheduled queue to the head or tail of the pending queue.
Usage:
falqon schedule -q, --queue=QUEUE
Options:
-q, --queue=QUEUE # Queue name
[--id=N] # Message ID
[--now] # Move message to head of pending queue (default)
[--later] # Move message to tail of pending queue
Instance Method Summary collapse
Instance Method Details
#execute ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/falqon/pro/cli/schedule.rb', line 37 def execute return super unless [:id] # Schedule message [:later] ? .schedule_later : .schedule_now puts "Scheduled message with ID #{[:id]} for #{[:later] ? 'later' : 'now'}" end |
#validate ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/falqon/pro/cli/schedule.rb', line 28 def validate super raise "--now, and --later require --id" if [[:now], [:later]].any? && ![:id] raise "No message with ID #{[:id]}" if [:id] && !.exists? raise "--now, and --later are mutually exclusive" if [[:now], [:later]].count(true) > 1 end |