NAME
Amazon::SQS::Simple::AnyEvent - A non-blocking API to Amazon's SQS
SYNOPSIS
use Amazon::SQS::Simple;
use Amazon::SQS::Simple::AnyEvent;
my $sqs = Amazon::SQS::Simple->new($access_key, $secret_key);
my $queue = $sqs->GetQueue($endpoint);
my $cb = sub {my $message = shift};
my $msg = $queue->ReceiveMessage(); # Blocking
my $guard = $queue->ReceiveMessage($cb); # Non-blocking
# do something else...
DESCRIPTION
This module adds non-blocking capbilities to Amazon::SQS::Simple via AnyEvent. It works by hijacking and replacing methods inside the Amazon::SQS::Simple
namespace. However, this could easily break if the internals of Amazon::SQS::Simple change. Also, this code is alpha quality with no automated tests. You have been warned.
METHODS
The following methods on Amazon::SQS::Simple::Queue are enhanced with non-blocking capabiliites. In all cases, adding a subroutine reference as the last argument will cause the method to be called in non-blocking mode. But instead of returning the results at the method call site, they will be passed to your callback. If the request fails, your callback will receive undef
and you can inspect the variable $Amazon::SQS::Simple::AnyEvent::ERROR
for a description of the last error. At the method call site, you will receive a guard object for the request. Otherwise, the calling interfaces are exactly the same as those described in Amazon::SQS::Simple::Queue. If you do not pass a callback argument, then the call is sent straight to the original blocking method in Amazon::SQS::Simple.
- SendMessage($message, [%opts], [sub{...}])
- SendMessageBatch($messages, [%opts], [sub{...}])
- ReceiveMessage([%opts], [sub{...}])
- ReceiveMessageBatch([%opts], [sub{...}])
- DeleteMessage($message, [%opts], [sub{...}])
- DeleteMessageBatch($messages, [%opts], [sub{...}])
AUTHOR
Jeffrey Ryan Thalhammer <jeff@thaljef.org>
Mike Whitaker <penfold@cpan.org>
Simon Whitaker <swhitaker@cpan.org>
SPONSOR
This module was commissioned by Ultrabuys LLC. Ultrabuys is proud to support Perl and the open source community.
LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
COPYRIGHT
Copyright (c) 2015 by Jeffrey Ryan Thalhammer