Example usage for com.amazonaws.services.simpleemail.model GetSendQuotaResult getMaxSendRate

List of usage examples for com.amazonaws.services.simpleemail.model GetSendQuotaResult getMaxSendRate

Introduction

In this page you can find the example usage for com.amazonaws.services.simpleemail.model GetSendQuotaResult getMaxSendRate.

Prototype


public Double getMaxSendRate() 

Source Link

Document

The maximum number of emails that Amazon SES can accept from the user's account per second.

Usage

From source file:com.irurueta.server.commons.email.AWSMailSender.java

License:Apache License

/**
 * Checks quota of sent emails to prevent AWS SES throttling.
 * @param currentTimestamp current timestamp.
 *//*from w  ww .j a  v a2  s . c o  m*/
private synchronized void checkQuota(long currentTimestamp) {
    if ((currentTimestamp - mLastSentMailTimestamp) > mCheckQuotaAfterMillis) {
        //check quota to determine the number of messages per second to
        //avoid throttling exceptions
        GetSendQuotaResult quota = mClient.getSendQuota();
        //updateinterval that we must wait between send requests
        mWaitIntervalMillis = (long) Math.ceil(MILLISECONDS_PER_SECOND / quota.getMaxSendRate());
    }
}

From source file:org.openchain.certification.utility.EmailUtility.java

License:Apache License

@SuppressWarnings("unused")
private static void logMailInfo(AmazonSimpleEmailServiceClient client, ServletConfig config) {
    logger.info("Email Service Name: " + client.getServiceName());
    List<String> identities = client.listIdentities().getIdentities();
    for (String identity : identities) {
        logger.info("Email identity: " + identity);
    }/*from  w  w w  . jav a  2  s  .co m*/
    List<String> verifiedEmails = client.listVerifiedEmailAddresses().getVerifiedEmailAddresses();
    for (String email : verifiedEmails) {
        logger.info("Email verified email address: " + email);
    }
    GetSendQuotaResult sendQuota = client.getSendQuota();
    logger.info("Max 24 hour send=" + sendQuota.getMax24HourSend() + ", Max Send Rate="
            + sendQuota.getMaxSendRate() + ", Sent last 24 hours=" + sendQuota.getSentLast24Hours());
}