String attributeName = "DeliveryPolicy";
String attributeValue = null;
try {
cns1.setSubscriptionAttributes(new SetSubscriptionAttributesRequest(subscriptionArn, attributeName, attributeValue));
fail("exception expected");
} catch (Exception ex) {
logger.info("expected exception", ex);
}
attributeValue = "{\"healthyRetryPolicy\":" +
"{"+
"\"numRetries\":43,"+
"\"numMaxDelayRetries\": 23,"+
"\"numMinDelayRetries\": 20,"+
"\"backoffFunction\": \"arithmetic\""+
"}," +
"\"throttlePolicy\":" +
"{" +
"\"maxReceivesPerSecond\":7" +
"}," +
"\"sicklyRetryPolicy\":" +
"{"+
"\"minDelayTarget\":2,"+
"\"maxDelayTarget\":3,"+
"\"numMinDelayRetries\": 4,"+
"\"numMaxDelayRetries\": 5,"+
"\"numNoDelayRetries\":6,"+
"\"backoffFunction\": \"exponential\""+
"}" +
"}";
try {
cns1.setSubscriptionAttributes(new SetSubscriptionAttributesRequest(subscriptionArn, attributeName, attributeValue));
fail("exception expected");
} catch (Exception ex) {
// DeliveryPolicy: healthyRetryPolicy.maxDelayTarget must be specified
logger.info("expected exception", ex);
}
attributeValue = "{\"healthyRetryPolicy\":" +
"{"+
"\"minDelayTarget\":5,"+
"\"maxDelayTarget\":3,"+
"\"numRetries\":43,"+
"\"numMaxDelayRetries\": 23,"+
"\"numMinDelayRetries\": 20,"+
"\"backoffFunction\": \"arithmetic\""+
"}," +
"\"throttlePolicy\":" +
"{" +
"\"maxReceivesPerSecond\":7" +
"}," +
"\"sicklyRetryPolicy\":" +
"{"+
"\"minDelayTarget\":2,"+
"\"maxDelayTarget\":3,"+
"\"numMinDelayRetries\": 4,"+
"\"numMaxDelayRetries\": 5,"+
"\"numNoDelayRetries\":6,"+
"\"backoffFunction\": \"exponential\""+
"}" +
"}";
try {
cns1.setSubscriptionAttributes(new SetSubscriptionAttributesRequest(subscriptionArn, attributeName, attributeValue));
fail("exception expected");
} catch (Exception ex) {
// DeliveryPolicy: healthyRetryPolicy.maxDelayTarget must be greater than or equal to minDelayTarget
logger.info("expected exception", ex);
}
attributeValue = "{\"healthyRetryPolicy\":" +
"{"+
"\"minDelayTarget\":2,"+
"\"maxDelayTarget\":3,"+
"\"numRetries\":20,"+
"\"numMaxDelayRetries\": 7,"+
"\"numMinDelayRetries\": 7,"+
"\"numNoDelayRetries\":7,"+
"\"backoffFunction\": \"arithmetic\""+
"}," +
"\"throttlePolicy\":" +
"{" +
"\"maxReceivesPerSecond\":7" +
"}," +
"\"sicklyRetryPolicy\":" +
"{"+
"\"minDelayTarget\":2,"+
"\"maxDelayTarget\":3,"+
"\"numMinDelayRetries\": 4,"+
"\"numMaxDelayRetries\": 5,"+
"\"numNoDelayRetries\":6,"+
"\"backoffFunction\": \"exponential\""+
"}" +
"}";
try {
cns1.setSubscriptionAttributes(new SetSubscriptionAttributesRequest(subscriptionArn, attributeName, attributeValue));
fail("exception expected");
} catch (Exception ex) {
// DeliveryPolicy: healthyRetryPolicy.numRetries must be greater than or equal to total of numMinDelayRetries, numNoDelayRetries and numMaxDelayRetries
logger.info("expected exception", ex);
}
attributeValue = "{\"healthyRetryPolicy\":" +
"{"+
"\"minDelayTarget\":2,"+
"\"maxDelayTarget\":3,"+
"\"numRetries\":21,"+
"\"numMaxDelayRetries\": 7,"+
"\"numMinDelayRetries\": 7,"+
"\"numNoDelayRetries\":7,"+
"\"backoffFunction\": \"arithmetic\""+
"}," +
"\"throttlePolicy\":" +
"{" +
"\"maxReceivesPerSecond\":7" +
"}," +
"\"sicklyRetryPolicy\":" +
"{"+
"\"minDelayTarget\":2,"+
"\"maxDelayTarget\":3,"+
"\"numRetries\":20,"+
"\"numMaxDelayRetries\": 7,"+
"\"numMinDelayRetries\": 7,"+
"\"numNoDelayRetries\":7,"+
"\"backoffFunction\": \"arithmetic\""+
"}" +
"}";
try {
cns1.setSubscriptionAttributes(new SetSubscriptionAttributesRequest(subscriptionArn, attributeName, attributeValue));
fail("exception expected");
} catch (Exception ex) {
// DeliveryPolicy: sicklyRetryPolicy.numRetries must be greater than or equal to total of numMinDelayRetries, numNoDelayRetries and numMaxDelayRetries
logger.info("expected exception", ex);
}