Amazon::SQS::Simple::Queue - OO API for representing queues from the Amazon Simple Queue Service.


NAME

Amazon::SQS::Simple::Queue - OO API for representing queues from the Amazon Simple Queue Service.


SYNOPSIS

    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');
    $q->SendMessage('Hello world!');
    my $msg = $q->ReceiveMessage();
    print $msg->MessageBody() # Hello world!
    $q->DeleteMessage($msg->MessageId());


INTRODUCTION

Don't instantiate this class directly. Objects of this class are returned by various methods in Amazon::SQS::Simple. See the Amazon::SQS::Simple manpage for more details.


METHODS

Endpoint()

Get the endpoint for the queue.

Delete($force, [%opts])

Deletes the queue. If $force is true, deletes the queue even if it still contains messages.

SendMessage($message, [%opts])

Sends the message. The message can be up to 256KB in size and should be plain text.

ReceiveMessage([%opts])

Get the next message from the queue.

Returns an Amazon::SQS::Simple::Message object. See the Amazon::SQS::Simple::Message manpage for more details.

Options for ReceiveMessage:

DeleteMessage($message_id, [%opts])

Delete the message with the specified message ID from the queue

PeekMessage($message_id, [%opts])

Fetch the message with the specified message ID. Unlike ReceiveMessage this doesn't affect the visibility of the message.

Returns an Amazon::SQS::Simple::Message object. See the Amazon::SQS::Simple::Message manpage for more details.

ChangeMessageVisibility($message_id, $timeout, [%opts])

Sets the timeout visibility of the message with the specified message ID to the specified timeout, in seconds.

Note that the timeout counts from the time the method is called. So if retrieved a message 30 seconds ago that had a timeout of 600 seconds, and call ChangeMessageVisility with a new timeout of 300s, the visibility will timeout in 300s.

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:

SetAttribute($attribute_name, $attribute_value, [%opts])

Sets the value for a queue attribute. Currently the only valid attribute name is VisibilityTimeout.

AddGrant($identifier, $permission, [%opts])

Adds the user identified by $identifier to the list of grantees for the list, with the permissions specified by $permission.

$identifier should be an email address of a person with an Amazon Web Services account. Alternatively, use a user ID in the format returned by ListGrants and add IdentifierType = 'ID'> to %opts.

$permission must be one of ReceiveMessage, SendMessage or FullControl.

RemoveGrant($identifier, $permission, [%opts])

Revokes the permissions specified by $permission from the user identified by $identifier for the list.

$identifier should be an email address of a person with an Amazon Web Services account. Alternatively, use a user ID in the format returned by ListGrants and add IdentifierType = 'ID'> to %opts.

$permission must be one of ReceiveMessage, SendMessage or FullControl.

ListGrants([%opts])

List the grantees for this queue. Returns a hashref mapping permission types to arrays of hashrefs identifying users.

Permission types will be one of RECEIVEMESSAGE, SENDMESSAGE or FULLCONTROL.

The hashrefs identifying users have the following keys:


AUTHOR

Copyright 2007 Simon Whitaker <swhitaker@cpan.org>

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.