class Beetle::JobTask

Overview

Defines a task to be executed as part of a Job. As with Job, this class is never created directly but rather by the Server object from the JSON payload associated with the /job request. The fields in the JSON payload are:

The actual sleep time is derived as a random (integer) value between sleep_min_msec and sleep_max_msec.

If a job task has a non-zero threshold defined and that threshold is exceeded during an execution of that job, and the /exec request payload set error_400_on_threshold_exceeded to true, the server will respond to the /exec request with a 400 return code.

For example (from a /job payload):

{
    :
    "tasks": [
        {
            "task_class": "BCaaS::ChargeTask",
            "weight": 3,
            "sleep_min_msec": 500,
            "sleep_max_msec": 1000
        },
        {
            "task_class": "BCaaS::Preauthorization",
            "weight": 1,
            "sleep_min_msec": 250,
            "sleep_max_msec": 750
        }
    ]
}

Included Modules

Defined in:

beetle/job-task.cr

Constructors

Constructor Detail

def self.new(pull : JSON::PullParser) #

[View source]