The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

taskqueued - Simple daemon for processing a cPanel::TaskQueue.

SYNOPSIS

    taskqueued

In order to make use of the cPanel::TaskQueue, you need some way to process the tasks in the queue. Although this process is not very difficult, there are a few subtleties to getting the processing correct.

The taskqueued program provides a simple version of this processing program. Unlike a proper production-quality processing daemon, this program does not support any form of logging, and only minor error recovery. It also does not support any easy way of shutting down or restarting the process while it is running.

DESCRIPTION

Although the taskqueued program is not a production-quality queue processing daemon, it does provides an example of every step needed to do correct handling of the cPanel::TaskQueue. This script provides a reasonable starting point for a production processing daemon.

CONFIGURATION

The taskqueueq program is configured through command line options or a configuration file. If the first parameter to the program starts with an @, the rest of the argument is treated as a configuration file name. If no configuration is passed on the command line, the program defaults to reading taskqueue.cfg in the current directory.

The configuration file just contains the command line options, one per line. Blank lines are ignored. Everything after the # character is treated as a comment and discarded.

The command line options that configure the program are

--dir={queuedir}

This required parameter specifies a directory in which we can find the TaskQueue's state files. The files to be accessed should be readable by the current user for the program to work.

--qname={queue name}

This optional parameter specifies the name associated with the TaskQueue object. It is used to create the name of the TaskQueue state file. If not supplied, a default value of main is used.

--sname={scheduler name}

This optional parameter specifies the name associated with the TaskQueue::Scheduler object. It is used to create the name of the TaskQueue::Scheduler state file. If not supplied, the specified queue name is used.

--plugindir={directory}

This required parameter may be specified multiple times to specify one or more directories to search for plugins. This directory name should not contain the namespace.

For example, if we are looking for the plugin TaskProcessor::NewCommands in the namespace TaskProcessor, and the plugin file is located at /usr/local/lib/taskplugins/TaskProcessor/NewCommands.pm. The plugindir would be /usr/local/lib/taskplugins and the namespace would be TaskProcessor.

These directories are also added to the Perl include directory list to allow loading any plugins we find.

--namespace={ns}

This optional parameter may be supplied multiple times to specify namespaces to search for plugins. If none are supplied, the default cPanel::TaskProcessors is used.

--plugin={modulename}

This optional parameter may be specified multiple times to specify the particular plugins to load. If this parameter is supplied, the plugin directories are not searched for plugins. Instead, only the specified plugins are loaded.

--logfile={filename}

This option parameter specifies the file to use for logging error messages. If not specified, the default logfile is written in the queue directory with the name {qname}_error.log.

DEPENDENCIES

In addition to the normal dependencies of the cPanel::TaskQueue module, this script requires Unix::PID to run.

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

No outstanding bugs.

LICENCE AND COPYRIGHT

Copyright (c) 2010, cPanel, Inc. 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.