public enum SqsMessageDeletionPolicy extends Enum<SqsMessageDeletionPolicy>
@SqsListener
annotation. The default policy is NO_REDRIVE
because it is the safest way to avoid poison messages and have
a safe way to avoid the loss of messages (i.e. using a dead letter queue).
The following deletion policies are available:
SqsListener
Enum Constant and Description |
---|
ALWAYS
Always deletes message in case of success (no exception thrown) or failure (exception thrown) during message
processing by the listener method.
|
NEVER
Never deletes message automatically.
|
NO_REDRIVE
Deletes message if no redrive policy is defined.
|
ON_SUCCESS
Deletes message when successfully executed by the listener method.
|
Modifier and Type | Method and Description |
---|---|
static SqsMessageDeletionPolicy |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static SqsMessageDeletionPolicy[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final SqsMessageDeletionPolicy ALWAYS
public static final SqsMessageDeletionPolicy NEVER
IMPORTANT: When using this policy the listener method must take care of the deletion of the messages. If not, it will lead to an endless loop of messages (poison messages).
Acknowledgment
public static final SqsMessageDeletionPolicy NO_REDRIVE
public static final SqsMessageDeletionPolicy ON_SUCCESS
public static SqsMessageDeletionPolicy[] values()
for (SqsMessageDeletionPolicy c : SqsMessageDeletionPolicy.values()) System.out.println(c);
public static SqsMessageDeletionPolicy valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullCopyright © 2019 Pivotal Software, Inc.. All rights reserved.