Class: Zenaton::Interfaces::Task Abstract

Inherits:
Job
  • Object
show all
Defined in:
lib/zenaton/interfaces/task.rb

Overview

This class is abstract.

Subclass and override #handle to define your custom tasks

Direct Known Subclasses

Tasks::Wait

Instance Method Summary collapse

Instance Method Details

#contextZenaton::Contexts::Task

Returns the task execution context.

Returns:



27
28
29
# File 'lib/zenaton/interfaces/task.rb', line 27

def context
  @context || Contexts::Task.new
end

#handleObject

Child classes should implement the handle method

Raises:



11
12
13
14
# File 'lib/zenaton/interfaces/task.rb', line 11

def handle
  raise NotImplemented,
        "Your workflow does not implement the `#handle' method"
end

#on_error_retry_delay(_exception) ⇒ Integer, ...

(Optional) Implement this method for automatic retrial of task in case of failures.

Parameters:

  • _exception (Exception)

    the reason for the task failure.

Returns:

  • (Integer, FalseClass, NilClass)

    the non-negative amount of seconds to wait before automatically retrying this task. Falsy values will avoid retrial. Other values will cause the retrial to fail.



22
23
24
# File 'lib/zenaton/interfaces/task.rb', line 22

def on_error_retry_delay(_exception)
  nil
end