abstract class Mosquito::Job
- Mosquito::Job
- Reference
- Object
Overview
A Job is a definition for work to be performed. Jobs are pieces of code which run a JobRun.
- Jobs prevent double execution of a job for a job_run
- Jobs Rescue when a #perform method fails a job_run for any reason
- Jobs can be rescheduleable
Included Modules
Direct Known Subclasses
Defined in:
mosquito/job.crConstant Summary
-
Log =
::Log.for(self)
Class Method Summary
- .metadata : Metadata
- .metadata_key
-
.queue
The Queue this job uses to store job_runs.
-
.queue_name : String
The queue this job is assigned to.
Macro Summary
- after(&block)
- before(&block)
-
queue_name(name)
Easily override the queue for any job.
Instance Method Summary
- #aborted?(*args, **options)
- #aborted?(*args, **options, &)
- #after_hook
- #before_hook
-
#exception : Exception | Nil
When a job fails and raises an exception, it will be saved into this attribute.
- #executed?(*args, **options)
- #executed?(*args, **options, &)
-
#fail(reason = "", *, retry : Bool = true)
To be called from inside a #perform Marks this job as a failure.
- #failed?(*args, **options)
- #failed?(*args, **options, &)
- #job_run_id : String | Nil
- #job_run_id=(job_run_id : String | Nil)
- #log(message)
- #metadata : Metadata
-
#perform
abstract, override in a Job descendant to do something productive
-
#reschedule_interval(retry_count : Int32) : Time::Span
abstract, override if desired.
-
#rescheduleable?(retry_count : Int32) : Bool
abstract, override if desired.
-
#rescheduleable? : Bool
abstract, override if desired.
- #retry_later
- #run
-
#should_retry : Bool
When a job run fails, should it be added to the retry queue? See: #fail(retry: false)
-
#should_retry=(should_retry : Bool)
When a job run fails, should it be added to the retry queue? See: #fail(retry: false)
- #state : Mosquito::Job::State
- #succeeded?(*args, **options)
- #succeeded?(*args, **options, &)
Instance methods inherited from module Mosquito::Serializers::Primitives
deserialize_bool(raw : String) : Bool
deserialize_bool,
deserialize_char(raw : String) : Char
deserialize_char,
deserialize_float32(raw : String) : Float32 | Nil
deserialize_float32,
deserialize_float64(raw : String) : Float64 | Nil
deserialize_float64,
deserialize_int128(raw : String) : Int128 | Nil
deserialize_int128,
deserialize_int16(raw : String) : Int16 | Nil
deserialize_int16,
deserialize_int32(raw : String) : Int32 | Nil
deserialize_int32,
deserialize_int64(raw : String) : Int64 | Nil
deserialize_int64,
deserialize_int8(raw : String) : Int8 | Nil
deserialize_int8,
deserialize_string(raw : String) : String
deserialize_string,
deserialize_u_int128(raw : String) : UInt128 | Nil
deserialize_u_int128,
deserialize_u_int16(raw : String) : UInt16 | Nil
deserialize_u_int16,
deserialize_u_int32(raw : String) : UInt32 | Nil
deserialize_u_int32,
deserialize_u_int64(raw : String) : UInt64 | Nil
deserialize_u_int64,
deserialize_u_int8(raw : String) : UInt8 | Nil
deserialize_u_int8,
deserialize_uuid(raw : String) : UUID
deserialize_uuid,
serialize_bool(value : Bool) : String
serialize_bool,
serialize_char(char : Char) : String
serialize_char,
serialize_float32(value) : String
serialize_float32,
serialize_float64(value) : String
serialize_float64,
serialize_int128(value) : String
serialize_int128,
serialize_int16(value) : String
serialize_int16,
serialize_int32(value) : String
serialize_int32,
serialize_int64(value) : String
serialize_int64,
serialize_int8(value) : String
serialize_int8,
serialize_string(str : String) : String
serialize_string,
serialize_symbol(sym : Symbol) : Nil
serialize_symbol,
serialize_u_int128(value) : String
serialize_u_int128,
serialize_u_int16(value) : String
serialize_u_int16,
serialize_u_int32(value) : String
serialize_u_int32,
serialize_u_int64(value) : String
serialize_u_int64,
serialize_u_int8(value) : String
serialize_u_int8,
serialize_uuid(uuid : UUID) : String
serialize_uuid
Class Method Detail
The queue this job is assigned to. By default every job has it's own named queue:
- EmailTheUniverseJob.queue = "email_the_universe"
Macro Detail
Instance Method Detail
When a job fails and raises an exception, it will be saved into this attribute.
To be called from inside a #perform Marks this job as a failure. By default, if the job is a candidate for re-scheduling, it will be run again at a later time.
abstract, override if desired.
For a given retry count, how long should the delay between job attempts be?
abstract, override if desired.
For a given retry count, is this job rescheduleable?
abstract, override if desired.
True if this job is rescheduleable, false if not.
When a job run fails, should it be added to the retry queue? See: #fail(retry: false)
When a job run fails, should it be added to the retry queue? See: #fail(retry: false)