<<

NAME

Koha::BackgroundJob - Koha BackgroundJob Object class

This is a base class for BackgroundJob, some methods must be subclassed.

Example of usage:

Producer: my $job_id = Koha::BackgroundJob->enqueue( { job_type => $job_type, job_size => $job_size, job_args => $job_args } );

Consumer: Koha::BackgrounJobs->find($job_id)->process; See also misc/background_jobs_worker.pl for a full example

API

Class methods

connect

Connect to the message broker using default guest/guest credential

enqueue

Enqueue a new job. It will insert a new row in the DB table and notify the broker that a new job has been enqueued.

job_size is the size of the job job_args is the arguments of the job. It's a structure that will be JSON encoded.

Return the job_id of the newly created job.

process

Process the job!

job_type

Return the job type of the job. Must be a string.

messages

Messages let during the processing of the job.

report

Report of the job.

cancel

Cancel a job.

<<