Amazon::SQS::Simple::Queue(3pm) | User Contributed Perl Documentation | Amazon::SQS::Simple::Queue(3pm) |
Amazon::SQS::Simple::Queue - OO API for representing queues from the Amazon Simple Queue Service.
use Amazon::SQS::Simple; my $access_key = 'foo'; # Your AWS Access Key ID my $secret_key = 'bar'; # Your AWS Secret Key my $sqs = new Amazon::SQS::Simple($access_key, $secret_key); my $q = $sqs->CreateQueue('queue_name'); # Single messages my $response = $q->SendMessage('Hello world!'); my $msg = $q->ReceiveMessage; print $msg->MessageBody; # Hello world! $q->DeleteMessage($msg); # or, for backward compatibility $q->DeleteMessage($msg->ReceiptHandle); # Batch messaging of up to 10 messages per operation my @responses = $q->SendMessageBatch( [ 'Hello world!', 'Hello again!' ] ); # or with defined message IDs $q->SendMessageBatch( { msg1 => 'Hello world!', msg2 => 'Hello again!' } ); my @messages = $q->ReceiveMessageBatch; $q->DeleteMessageBatch( \@messages );
Don't instantiate this class directly. Objects of this class are returned by various methods in "Amazon::SQS::Simple". See Amazon::SQS::Simple for more details.
Returns one or more "Amazon::SQS::Simple::Message" objects (depending on whether called in list or scalar context), or undef if no messages are retrieved.
NOTE: This behaviour has changed slightly since v1.06. It now always returns the first message in scalar context, irrespective of how many there are.
See Amazon::SQS::Simple::Message for more details.
Options for ReceiveMessage:
Maximum number of messages to return (integer from 1 to 20). SQS never returns more messages than this value but might return fewer. Not necessarily all the messages in the queue are returned. Defaults to 1.
Long poll support (integer from 0 to 20). The duration (in seconds) that the 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 WaitTimeSeconds in the request, the queue attribute ReceiveMessageWaitTimeSeconds is used to determine how long to wait.
The duration in seconds (integer from 0 to 43200) that the received messages are hidden from subsequent retrieve requests after being retrieved by a ReceiveMessage request.
If you do not specify VisibilityTimeout in the request, the queue attribute VisibilityTimeout is used to determine how long to wait.
Changes the visibility of the message with the specified receipt handle to $timeout seconds. $timeout must be in the range 0..43200.
Sets a permissions policy with the specified label. $account_actions is a reference to a hash mapping 12-digit AWS account numbers to the action(s) you want to permit for those account IDs. The hash value for each key can be a string (e.g. "ReceiveMessage") or a reference to an array of strings (e.g. ["ReceiveMessage", "DeleteMessage"])
Removes the permissions policy with the specified label.
Chris Jones provied the batch message code in release 2.0
Copyright 2007-2008 Simon Whitaker <swhitaker@cpan.org> Copyright 2013-2017 Mike (no relation) Whitaker <penfold@cpan.org>
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
2021-01-09 | perl v5.32.0 |