NAME

QueueDaemon.pl - wrapper for queue handler daemons

SYNOPSIS

QueueDaemon.pl options

Read and process SQS messages.

DESCRIPTION

Implements a daemon that reads from Amazon's Simple Queue Service (SQS).

OPTIONS

-h, --help               help
-c, --config             config file name
-C, --create-queue       create the queue if it does not exist
-d, --daemonize          daemonize the script (default)
    --no-daemonize       
-D, --delete-when        never, always, error
-E, --exit-when          never, always, error, false
-e, --endpoint-url       default: https://sqs.amazonaws.com
-L, --logfile            name of logfile
-l, --loglevel           log level (trace, debug, info, warn, error)
-H, --handler            name of the handler class, default: Amazon::SQS::QueueHandler
-m, --max-children       not implemented (default: 1)
-s, --max-sleep-time     default: 5 seconds
    --max-messages       fixed at 1 currently
-M, --message-type       mime type of messages (text/plain, application/json, 
                         application/x-www-form-encoded), default: text/plain
-q, --queue              queue name (not url)
    --queue-interval     amount of time to sleep
-p, --pidfile            fully qualified path of pid file, default: /var/run/QueueDaemon.pl.in
-v, --visibility-timeout visibility timeout in seconds, default: 30
-w, --wait-time          long polling wait time in seconds, default: 0

LICENSE

(c) Copyright 2024 TBC Development Group, LLC. All rights reserved. This is free software and may be used or distributed under the same terms as Perl itself.

FEATURES

  • easy configuration using the command line options or a configuration file

  • automatically create a queue if it doesn't exist

  • long or short polling. Set --wait-time for long polling, --queue-interval for short polling

  • configurable message disposition options for successful handling of messages and exceptions

  • can be run as a daemon or in a terminal

HINTS & TIPS

Quick Start

QueueDaemon.pl --create-queue -q fooManQueue
1. If the queue does not exist it will be created if you use the --create-queue option.
2. If no logfile is given, log output will be sent to STDERR
3. See Amazon::SQS::Config regarding the available options in a config file.
4. The default is to daemonize the script. Use --no-daemonize to run in a terminal.
5. If you do not provide a handler on the command line or in your .ini file the default handler will be used. The default hanlder will dump the message to the log and delete the message.
6. By default messages will only be deleted from the queue if your handler returns a true value. If you want to delete messages which cannot be decoded or when you handler returns a non-true value, set the --delete-when or set 'delete' option in the [error] section of your .ini file.
7. To exit the daemon when your handler returns a non-true value set the --exit-when option to 'false' or in the [error] section of your .ini file, set 'exit = false'.
8. To exit the daemon if your handler throws an exception, set the --exit-when option to 'error' or in the [error] section of your .ini file, set 'exit = error'.

The daemon can be started using the helper script aws-sqsd.

Starting

By default the startup script will look for the script (QueueDaemon.pl) and the configuration file (aws-sqs.ini) in all of the places where they should have been installed regardless of whether you installed the program as a CPAN distribution or manually (./configure && make && make install). If you've relocated the program or the configuration file you use environment variables to tell the startup script where to look for these artifacts.

CONFIG - fully qualified path the configuration file
DAEMON - fully qualified path to the QueueDaemon.pl script.
sudo CONFIG=/etc/myapp/aws-sqs.ini aws-sqsd start
Stopping
sudo /sbin/service aws-sqsd stop
Restarting
$ sudo /sbin/service aws-sqsd restart
Rereading Config file after changes
$ sudo /sbin/service aws-sqsd graceful

CONFIGURATION

See "Amazon::SQS::Config"

AUTHOR

Rob Lauer - <bigfoot@cpan.org>

SEE ALSO

Proc::Daemon, Amazon::SQS::Config, Amazon::SQS::Client