NAME

Resque::Job - Resque job container

VERSION

version 0.41

ATTRIBUTES

resque

Provides 'redis' method, which provides access to our redis subsystem.

worker

Worker running this job. A new worker will be popped up from resque by default.

class

Class to be performed by this job.

queue

Name of the queue this job is or should be.

args

Array of arguments for this job.

payload

HashRef representation of the job. When passed to constructor, this will restore the job from encoded state. When passed as a string this will be coerced using JSON decoder. This is read-only.

METHODS

encode

String representation(JSON) to be used on the backend.

$job->encode();

stringify

Returns a string version of the job, like

'(Job{queue_name) | ClassName | args_encoded)'

my $stringified = $job->stringify();

queue_from_class

Normalize class name to be used as queue name.

my $queue_name = $job->queue_from_class();

NOTE: future versions will try to get the
      queue name from the real class attr
      or $class::queue global variable.

perform

Load job class and call perform() on it. This job object will be passed as the only argument.

$job->perform();

enqueue

Add this job to resque. See Rescue::push().

$job->enqueue();

dequeue

Remove this job from resque using the most restrictive form of Resque::mass_dequeue. This method will remove all jobs matching this object queue, class and args.

See Resque::mass_dequeue() for massive destruction.

$job->enqueue();

fail

Store a failure (or exception and failure) on this job.

$job->fail( "error message'); # or
$job->fail( ['exception', 'error message'] );

payload_builder

Default payload builder method. This method is public only to be wrapped in the context of plugins that adds attributes to this class.

payload_reader

Default payload trigger method. This method is public only to be wrapped in the context of plugins that adds attributes to this class.

This mehtod is only called at construction time to populate job class and args attributes from payload.

AUTHOR

Diego Kuperman <diego@freekeylabs.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2021 by Diego Kuperman.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.