Amazon-SQS-Simple
view release on metacpan or search on metacpan
1.04 23 May 2009
Added support for API version 2009-02-01
Removed support for API version 2007-05-01
1.05 14 Nov 2009
Minor tweak to improve the lives of folks using strict and mod_perl
(Thanks to Stephen Sayre)
1.06 31 Mar 2010
Added Timeout constructor arg
2.00 22 May 2013
New Maintainer (PENFOLD)
ReceiveMessage now always returns the first message in scalar context, irrespective of how many there are.
(previously if there were more than one, it would return a count)
Updated to support and default to SignatureVersion 2, stub SignatureVersion 3 (Roland Walker)
Proxy Support (James Neal)
Added SendMessageBatch, ReceiveMessageBatch (Chris Jones)
2.01 1 Jul 2013
bin/sqs-toolkit view on Meta::CPAN
}
$queue->DeleteMessage($msg->ReceiptHandle);
}
}
sub q_timeout {
my $queue = shift;
my $t = shift;
if (defined $t) {
$queue->SetAttribute('VisibilityTimeout', $t);
}
else {
my $href = $queue->GetAttributes();
return $href->{VisibilityTimeout};
}
}
lib/Amazon/SQS/Simple.pm view on Meta::CPAN
Constructs a new Amazon::SQS::Simple object
C<$access_key> is your Amazon Web Services access key. C<$secret_key> is your Amazon Web
Services secret key. If you don't have either of these credentials, visit
L<http://aws.amazon.com/>.
Options for new:
=over 4
=item Timeout => SECONDS
Set the HTTP user agent's timeout (default is 180 seconds)
=item Version => VERSION_STRING
Specifies the SQS API version you wish to use. E.g.:
my $sqs = new Amazon::SQS::Simple($access_key, $secret_key, Version => '2008-01-01');
=back
lib/Amazon/SQS/Simple.pm view on Meta::CPAN
=item CreateQueue($queue_name, [%opts])
Creates a new queue with the given name. Returns a
C<Amazon::SQS::Simple::Queue> object. (See L<Amazon::SQS::Simple::Queue> for details.)
Options for CreateQueue:
=over 4
=item DefaultVisibilityTimeout => SECONDS
Set the default visibility timeout for this queue
=back
=item ListQueues([%opts])
Gets a list of all your current queues. Returns an array of
C<Amazon::SQS::Simple::Queue> objects. (See L<Amazon::SQS::Simple::Queue> for details.)
lib/Amazon/SQS/Simple/Base.pm view on Meta::CPAN
Endpoint => +BASE_ENDPOINT,
SignatureVersion => 4,
Version => $DEFAULT_SQS_VERSION,
@args
};
if (!defined($self->{UserAgent})) {
$self->{UserAgent} = LWP::UserAgent->new(keep_alive => 4);
}
if (defined($self->{Timeout})) {
$self->{UserAgent}->timeout($self->{Timeout});
}
if (!defined($self->{Region})) {
$self->{Region} = 'us-east-1';
}
$self->{UserAgent}->env_proxy;
if (!$self->{UseIAMRole} && (!$self->{AWSAccessKeyId} || !$self->{SecretKey})) {
croak "Missing AWSAccessKey or SecretKey";
lib/Amazon/SQS/Simple/Queue.pm view on Meta::CPAN
sub ChangeMessageVisibility {
my ($self, $receipt_handle, $timeout, %params) = @_;
if (!defined($timeout) || $timeout =~ /\D/ || $timeout < 0 || $timeout > 43200) {
croak "timeout must be specified and in range 0..43200";
}
$params{Action} = 'ChangeMessageVisibility';
$params{ReceiptHandle} = $receipt_handle;
$params{VisibilityTimeout} = $timeout;
my $href = $self->_dispatch(\%params);
}
our %valid_permission_actions = map { $_ => 1 } qw(* SendMessage ReceiveMessage DeleteMessage ChangeMessageVisibility GetQueueAttributes);
sub AddPermission {
my ($self, $label, $account_actions, %params) = @_;
$params{Action} = 'AddPermission';
lib/Amazon/SQS/Simple/Queue.pm view on Meta::CPAN
=item * WaitTimeSeconds => INTEGER
Long poll support (integer from 0 to 20). The duration (in seconds) that the I<ReceiveMessage> action call will wait
until a message is in the queue to include in the response, as opposed to returning an empty response if a message
is not yet available.
If you do not specify I<WaitTimeSeconds> in the request, the queue attribute I<ReceiveMessageWaitTimeSeconds>
is used to determine how long to wait.
=item * VisibilityTimeout => INTEGER
The duration in seconds (integer from 0 to 43200) that the received messages are hidden from subsequent retrieve
requests after being retrieved by a I<ReceiveMessage> request.
If you do not specify I<VisibilityTimeout> in the request, the queue attribute I<VisibilityTimeout> is used to
determine how long to wait.
=back
=item B<ReceiveMessageBatch([%opts])>
As ReceiveMessage(MaxNumberOfMessages => 10)
=item B<DeleteMessage($message, [%opts])>
lib/Amazon/SQS/Simple/Queue.pm view on Meta::CPAN
Removes the permissions policy with the specified label.
=item B<GetAttributes([%opts])>
Get the attributes for the queue. Returns a reference to a hash
mapping attribute names to their values. Currently the following
attribute names are returned:
=over 4
=item * VisibilityTimeout
=item * ApproximateNumberOfMessages
=back
=item B<SetAttribute($attribute_name, $attribute_value, [%opts])>
Sets the value for a queue attribute. Currently the only valid
attribute name is C<VisibilityTimeout>.
=back
=head1 ACKNOWLEDGEMENTS
Chris Jones provied the batch message code in release 2.0
=head1 AUTHOR
Copyright 2007-2008 Simon Whitaker E<lt>swhitaker@cpan.orgE<gt>
( run in 0.602 second using v1.01-cache-2.11-cpan-a5abf4f5562 )