Amazon-SQS-Client
view release on metacpan or search on metacpan
lib/Amazon/SQS/Config.pm view on Meta::CPAN
my $name = $section eq 'main' ? $_ : "${section}_$_";
$self->set( "$name", $section_config{$_} );
}
}
}
return $self;
}
1;
__END__
=pod
=head1 NAME
Amazon::SQS::Config - configuration file class for Amazon::SQS::QueueHandler
=head1 SYNOPSIS
my $config = Amazon::SQS::Config->new( file => 'amazon-sqs.ini' );
my $config = Amazon::SQS::Config->new( file => \*DATA );
I<NOTE: you won't typically create your own configuration objects as
this is done as part of the F<QueueDaemon.pl> startup procedure.>
=head1 DESCRIPTION
L<Config::IniFiles> based class to retrieve configuration information for
AWS SQS services from a F<.ini> style file.
=head1 SECTIONS
The configuration file should contain multiple sections describe below.
=head2 handler
The handler section describes your queue handler and other attributes
that control how messages are processed.
[handler]
class = MyHandler
message_type = application/json
max_children = 1
=over 5
=item class
Name of the class that implements your handler. If you do not provide
a class the default class L<Amazon::SQS::QueueHandler> is used. That
class will dump and delete each message it reads.
=item message_type
The message mime type. Can be one of 'text/plain', 'application/json',
or 'application/x-www-form-urlencoded'.
If the message type is 'application/json' it will be decoded using the
L<JSON> class. If the message type is
'application/x-www-form-urlencoded' the message will be decode using
L<CGI::Simple> and returned as a hash reference.
default: text/plain
I<NOTE: The message sent to your handler is the decoded message. The
raw message is available using the C<get_raw_message> method. The
decoded messsage is also available using the getter C<get_message>.>
=item max_children
The maximum number of children that can be instantiated by the
F<QueuDaemon.pl> script. Currently the maximum is 1. Future versions
may support forking.
=item pidfile
Path of the pid file.
default: /var/run/QueueDaemon.pl.pid
=back
=head2 error
The exit section describes what to do with messages when they are
handled successfully or when an error occurs. Your handler should
return a true value indicating it successfully handled the message and
a false value otherwise. Options here then describe what actions to
take based on the result of calling your handler.
There are three outcomes possible when processing the message:
=over 5
=item 1. Your handler returned a true value
=item 2. Your handler returned a false value
=item 3. Your handler or decoding the message resulted in an exception
=back
Two configuration values (C<exit>, C<delete>) control what to do next.
[error]
exit = error
delete = true
=over 5
=item exit
=over 10
=item * error
Exit whenever an exception occurs.
=item * never
Never exit.
=item * always
Exit after processing any message, regardless of state.
=item * false
( run in 0.991 second using v1.01-cache-2.11-cpan-39bf76dae61 )