NAME

Catalyst::Engine::JobQueue::POE - Cron-like job runner engine

VERSION

This document describes Catalyst::Engine::JobQueue::POE version 0.0.3

SYNOPSIS

A script using the Catalyst::Engine::JobQueue::POE module might look like:

#!/usr/bin/perl

use strict;
use lib '/path/to/MyApp/lib';

BEGIN {
  $ENV{CATALYST_ENGINE} = 'JobQueue::POE';
}

use MyApp;

MyApp->run;

By specifying the appropiate environment variable, Catalyst will start the JobQueue runner with the POE engine.

DESCRIPTION

This is the Catalyst Engine specialized for running the JobQueue with POE.

INTERFACE

$self->get_job( $id )

Returns the job object with the given ID.

OVERLOADED METHODS

This class overloads some methods from Catalyst::Engine.

$self->prepare_headers

$self->write

DIAGNOSTICS

Fatal errors

These will cause the JobQueue runner to stop.

Cannot find schedule file "%s"

The configured schedule file doesn't exist. Check that you have supplied the correct filename, or that a file named crontab exists if no schedule_file option was set.

Cannot open crontab "%s" for reading, "%s"

The crontab file could not be read. The message at the end is the system error. Check permissions.

Warnings

These will warn you of some recoverable error.

Missing renderer %s [skipping]

A renderer configured to deliver the job response could not be found. Check the configuration and docs for supported renderers.

CONFIGURATION AND ENVIRONMENT

Catalyst::Engine::JobQueue::POE can be configured with the standard Catalyst configuration mechanism. It also uses environment variables for debugging and its own format for job configuration.

Catalyst configuration

These should appear under the Catalyst::Engine::JobQueue::POE key.

schedule_file

The path to the file which describes the jobs to be run. See "Job Configuration" for more details. Relative to the application root.

render

Describes how the JobQueue shoudl handle responses

to

A list of renderers to send the response to. Valid renderers are: log and email.

log

The log renderer sends the response body to the Catalyst logger.

level

The log level at which the response is logged. See Catalyst::Log for more details. The default value is info.

email

The email renderer sends the response via email to a given address. The content type, charset and encoding are taken from the appropiate response header (Content-Type and Content-Encoding). The subject is "Response for Job <ID>".

from

The address from which the email will be sent. The default value is <catalyst@localhost>.

to

The address to which the email will be sent. The default value is <root@localhost>.

smtp

The name of the SMTP server. The default value is localhost.

disposition

How the response body should be added to the email. Valid values are inline and attachment. The default value attachemnt.

Environment variables

If you set CATALYST_POE_DEBUG environment variable to a true value (like 1 or 'yes'), debug messages will be printed to STDOUT.

Job configuration

A job configuration file describes jobs and when to run them. It's syntax is modeled after the crontab file syntax.

Each line describes a job. Comments start with '#' and run to the end of the line.

Fields are separated by space. The first five fields describe how often the job will be run, identical to the crontab syntax (minute, hour, day of month, month, day of week). The 6th field specifies a user which the job will be run as (currently unused). The 7th field specifies the path used for the job request and the rest can be used to provide additional parameters to the request.

DEPENDENCIES

Catalyst

POE::Component::Cron

Email::MIME::Creator

Email::Send

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests to bug-catalyst-engine-jobqueue-poe@rt.cpan.org, or through the web interface at http://rt.cpan.org.

AUTHOR

Gruen Christian-Rolf <kiki@abc.ro>

LICENCE AND COPYRIGHT

Copyright (c) 2006, Gruen Christian-Rolf <kiki@abc.ro>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

SEE ALSO

Catalyst, Catalyst::JobQueue::Job