Reputation: 522
As per what this documentation says, if I reach the max send rate, I will get an error. My max send rate is 14 emails per second and I tried to send 100 mails concurrenlty, all the emails arrived to the recipient.
So I wonder why Amazon SES didn't send any "signal" complaining about my excess or easier, why Amazon SES did deliver all those 100 emails when it was supposed to send only 14.
Here is the code I used:
List<String> destinations = new ArrayList<>(); //replace with your TO email addresses
for (int i = 0; i < 100; i++) {
destinations.add("Receiver address");
}
int i=0;
for (String destination : destinations) {
new Thread("" + i){
public void run(){
System.out.println("Thread: " + getName() + " running");
int maxRetries = 10;
while(maxRetries-->0) {
try {
// Create the subject and body of the message.
Content subject = new Content().withData("Asunto");
Content textBody = new Content().withData("cuerpo");
Body body = new Body().withText(textBody);
// Create a message with the specified subject and body.
Message message = new Message().withSubject(subject).withBody(body);
Destination destination2 = new Destination().withToAddresses(new String[]{destination});
// Assemble the email.
SendEmailRequest request = new SendEmailRequest().withSource("fromnaddres").withDestination(destination2).withMessage(message);
//wait for a permit to become available
//rateLimiter.acquire();
//call Amazon SES to send the message
SendEmailResult result = client.sendEmail(request);
System.out.println("sent "+result.getMessageId());
break;
} catch (AmazonServiceException e) {
//retries only throttling errors
System.out.println("hola");
if ("Throttling".equals(e.getErrorCode()) && "Maximum sending rate exceeded.".equals(e.getMessage())) {
System.out.println("Maximum send rate exceeded when sending email to "+destination+". "
+(maxRetries>1?"Will retry.":"Will not retry.") );
} else {
System.out.println("Unable to send email to: "+destination+". " +e.toString());
break;
}
} catch(Exception e) {
System.out.println("Unable to send email to: "+destination+". " +e.toString());
break;
}
}
}
}.start();
i++;
}
Upvotes: 0
Views: 2312
Reputation: 2756
Amazon SES gives some room or flexibility on either Daily message quota and Maximum sending rate. They don't disclose which is the deviation percentage allowed, but you could definitely find out by doing some tests.
Upvotes: 4