NAME

Stub::StubService - Helios::Service subclass to handle [job type here] jobs

DESCRIPTION

This is a stub class to use as a guide to create new services for the Helios system.

RETRY METHODS

Define MaxRetries() and RetryInterval() methods to determine how many times a job should be retried if it fails and what the interval between the retries should be. If you don't define these methods, jobs for your service will not be retried if they fail.

The commented lines below set a job to be retried twice at 1 hour intervals. RetryInterval() values are in seconds.

run($job)

The run() method is the method called to actually run a job. It is called as an object method, and will be passed a Helios::Job object representing the job arguments and other information associated with the job to be run.

Once the work for a particular job is done, you should mark the job as either completed or failed. You can do this by calling the completedJob() or failedJob() methods. These methods will call the appropriate Helios::Job methods to mark the job as completed.

Most Helios classes and methods will throw exceptions if there are problems, as will the code in many other CPAN distributions. To catch these errors before they blow up your worker process altogether, use the eval {} or do {}; construct to catch these errors and deal with them appropriately. For cleaner exception syntax, look for the Try::Tiny module on CPAN.

SEE ALSO

Helios::Service, helios.pl