or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

async-operations.mdbuffered-client.mdclient-management.mddead-letter-queues.mdindex.mdmessage-operations.mdmessage-visibility.mdqueue-operations.mdqueue-permissions.mdqueue-tagging.md

dead-letter-queues.mddocs/

0

# Dead Letter Queues

1

2

Dead Letter Queue (DLQ) operations provide management of message redrive policies, source queue discovery, and message movement tasks for handling messages that cannot be processed successfully.

3

4

## List Dead Letter Source Queues

5

6

### Find Source Queues

7

8

Discover which queues use a specific queue as their dead letter queue.

9

10

```java { .api }

11

ListDeadLetterSourceQueuesResult listDeadLetterSourceQueues(ListDeadLetterSourceQueuesRequest request);

12

13

// Convenience method

14

ListDeadLetterSourceQueuesResult listDeadLetterSourceQueues(String queueUrl);

15

16

class ListDeadLetterSourceQueuesRequest extends AmazonWebServiceRequest {

17

String getQueueUrl();

18

ListDeadLetterSourceQueuesRequest withQueueUrl(String queueUrl);

19

20

String getNextToken();

21

ListDeadLetterSourceQueuesRequest withNextToken(String nextToken);

22

23

Integer getMaxResults();

24

ListDeadLetterSourceQueuesRequest withMaxResults(Integer maxResults);

25

}

26

27

class ListDeadLetterSourceQueuesResult {

28

List<String> getQueueUrls();

29

String getNextToken();

30

}

31

```

32

33

## Message Move Tasks

34

35

### Start Message Move Task

36

37

Move messages from a dead letter queue back to their source queue.

38

39

```java { .api }

40

StartMessageMoveTaskResult startMessageMoveTask(StartMessageMoveTaskRequest request);

41

42

class StartMessageMoveTaskRequest extends AmazonWebServiceRequest {

43

String getSourceArn();

44

StartMessageMoveTaskRequest withSourceArn(String sourceArn);

45

46

String getDestinationArn();

47

StartMessageMoveTaskRequest withDestinationArn(String destinationArn);

48

49

Integer getMaxNumberOfMessagesPerSecond();

50

StartMessageMoveTaskRequest withMaxNumberOfMessagesPerSecond(Integer maxNumberOfMessagesPerSecond);

51

}

52

53

class StartMessageMoveTaskResult {

54

String getTaskHandle();

55

}

56

```

57

58

### Cancel Message Move Task

59

60

Stop an in-progress message move operation.

61

62

```java { .api }

63

CancelMessageMoveTaskResult cancelMessageMoveTask(CancelMessageMoveTaskRequest request);

64

65

class CancelMessageMoveTaskRequest extends AmazonWebServiceRequest {

66

String getTaskHandle();

67

CancelMessageMoveTaskRequest withTaskHandle(String taskHandle);

68

}

69

70

class CancelMessageMoveTaskResult {

71

String getApproximateNumberOfMessagesMoved();

72

}

73

```

74

75

### List Message Move Tasks

76

77

View active and completed message move tasks.

78

79

```java { .api }

80

ListMessageMoveTasksResult listMessageMoveTasks(ListMessageMoveTasksRequest request);

81

82

class ListMessageMoveTasksRequest extends AmazonWebServiceRequest {

83

String getSourceArn();

84

ListMessageMoveTasksRequest withSourceArn(String sourceArn);

85

86

Integer getMaxResults();

87

ListMessageMoveTasksRequest withMaxResults(Integer maxResults);

88

}

89

90

class ListMessageMoveTasksResult {

91

List<ListMessageMoveTasksResultEntry> getResults();

92

}

93

```

94

95

**Usage Example:**

96

97

```java

98

// Find source queues for a DLQ

99

ListDeadLetterSourceQueuesResult sources = client.listDeadLetterSourceQueues(dlqUrl);

100

System.out.println("Source queues: " + sources.getQueueUrls());

101

102

// Move messages back to source

103

String sourceArn = "arn:aws:sqs:us-east-1:123456789012:SourceQueue";

104

String dlqArn = "arn:aws:sqs:us-east-1:123456789012:DeadLetterQueue";

105

106

StartMessageMoveTaskResult moveTask = client.startMessageMoveTask(

107

new StartMessageMoveTaskRequest()

108

.withSourceArn(dlqArn)

109

.withDestinationArn(sourceArn)

110

.withMaxNumberOfMessagesPerSecond(100));

111

112

String taskHandle = moveTask.getTaskHandle();

113

System.out.println("Started move task: " + taskHandle);

114

115

// Monitor or cancel if needed

116

client.cancelMessageMoveTask(new CancelMessageMoveTaskRequest()

117

.withTaskHandle(taskHandle));

118

```