forked from awsdocs/aws-doc-sdk-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRedrivePolicy.java
More file actions
21 lines (17 loc) · 939 Bytes
/
Copy pathRedrivePolicy.java
File metadata and controls
21 lines (17 loc) · 939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
// snippet-start:[sns.java.redrive_policy]
// 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);
// snippet-end:[sns.java.redrive_policy]