Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions,
see Getting Started with Amazon Web Services in China
(PDF).
Use SetSubscriptionAttributesRedrivePolicy
with an Amazon SDK
The following code example shows how to use SetSubscriptionAttributesRedrivePolicy
.
- Java
-
- SDK for Java 1.x
-
// Specify the ARN of the Amazon SNS subscription.
String subscriptionArn =
"arn:aws:sns:us-east-2:123456789012:MyEndpoint:1234a567-bc89-012d-3e45-6fg7h890123i";
// Specify the ARN of the Amazon SQS queue to use as a dead-letter queue.
String redrivePolicy =
"{\"deadLetterTargetArn\":\"arn:aws:sqs:us-east-2:123456789012:MyDeadLetterQueue\"}";
// Set the specified Amazon SQS queue as a dead-letter queue
// of the specified Amazon SNS subscription by setting the RedrivePolicy attribute.
SetSubscriptionAttributesRequest request = new SetSubscriptionAttributesRequest()
.withSubscriptionArn(subscriptionArn)
.withAttributeName("RedrivePolicy")
.withAttributeValue(redrivePolicy);
sns.setSubscriptionAttributes(request);
For a complete list of Amazon SDK developer guides and code examples, see
Using Amazon SNS with an Amazon SDK.
This topic also includes information about getting started and details about previous SDK versions.