fleetfootmike / amazon-sqs-simple Goto Github PK
View Code? Open in Web Editor NEWPerl module for interfacing with Amazon's Simple Queue Service
Home Page: http://search.cpan.org/dist/Amazon-SQS-Simple
License: Other
Perl module for interfacing with Amazon's Simple Queue Service
Home Page: http://search.cpan.org/dist/Amazon-SQS-Simple
License: Other
Is the bug from https://rt.cpan.org/Public/Bug/Display.html?id=95807 fixed here?
System: Ubuntu 14.04 trusty
Amazon::SQS::Simple from ubuntu package libamazon-sqs-simple-perl 2.03-1
(our $VERSION = '2.03';)
Using it to send messages only, it works fine most of the time but
sometime I get the error:
ERROR [try ]: On calling SendMessage: 403 Forbidden (The AWS Access Key
Id you provided does not exist in our records.)
If that's the case I notice that Amazon::SQS::Simple::Queue has wrong
AWSAccessKeyId, here's dump of the object:
$VAR1 = bless({
'SignatureVersion' => 2,
'SecretKey' => 'correct secret key is here',
'Version' => '2012-11-05',
'Endpoint' => 'http://queue.amazonaws.com/089741050239 ...',
'AWSAccessKeyId' => 'AWSAccessKeyId'
}, 'Amazon::SQS::Simple::Queue' );
AWSAccessKeyId is set to 'AWSAccessKeyId'. At first I thought I am doing
something wrong but it's a pretty simple script that gets both aws
access key and aws secret key from command line. I run it number of
times and most of the time it does work but sometime it doesn't (in
approximately 10% to 20% it does not work).
This code causes a crash:
my $sqs = new Amazon::SQS::Simple( $access_key, $secret_key );
my $q = $sqs->GetQueue($endpoint);
my $msg = $q->ReceiveMessage();
Error msg:
Can't locate object method "host" via package "URI::_foreign" at /Users/jean/perl5/perlbrew/perls/perl-5.16.2_threads/lib/site_perl/5.16.2/Amazon/SQS/Simple/Base.pm line 227.
From http://docs.aws.amazon.com/general/latest/gr/signature-version-2.html:
The following regions do not support Signature Version 2, regardless of which service you're using:
China (Beijing)
EU (Frankfurt)
Because Amazon::SQS::Simple only implements v2 signatures, it cannot be used with eu-central-1, as we discovered this week at work when eu-west-1 had issues! :)
Might be worth reviewing pull request #7
I would like an option for retry such as http://search.cpan.org/~pfig/Net-Amazon-S3-0.60/lib/Net/Amazon/S3.pm
I sometimes encounter 403 error.
Now I manually retry.
my $res;
my $sleep = 1; # 1 second
my $retry_max = 10;
my $failed = 0;
while (! $res ) {
my $sqs = Amazon::SQS::Simple->new( $aws_access_key, $aws_secret_key );
$sqs->{Endpoint} = "https://ap-northeast-1.queue.amazonaws.com";
my $q = $sqs->CreateQueue($queue_name);
my $message = "Hello!";
eval { $res = $q->SendMessage($message) };
if ($@) {
sleep $sleep;
$sleep *= 2; # exponential backoff
$failed++;
if ($failed == $retry_max) {
last; # give up ...
}
}
}
Or please let me know the better way.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.