-
Notifications
You must be signed in to change notification settings - Fork 12
/
VisibilityExtender.java
35 lines (31 loc) · 1.61 KB
/
VisibilityExtender.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.jashmore.sqs.processor.argument;
import java.util.concurrent.Future;
/**
* Used to extend the visibility of a message that is being processed in the scenario that the processing of a message takes a long time.
*/
public interface VisibilityExtender {
/**
* The default amount of time that the message will be extended in visibility of {@link #extend()} is called.
*/
int DEFAULT_VISIBILITY_EXTENSION_IN_SECONDS = 120;
/**
* Extend the visibility of a message that is being processed by {@link #DEFAULT_VISIBILITY_EXTENSION_IN_SECONDS} seconds so that the message will not be
* retried even when it is happily processing the message.
*
* <p>This is useful if you are doing a task that can take a considerable amount of time to process. You can use this to extend the visibility
* of the message until you have finished processing the message.
*
* @return a future for when the beat has been acknowledged
*/
Future<?> extend();
/**
* Extend the visibility of a message that is being processed so that it will not go back for reprocessing by a given amount of time in seconds.
*
* <p>This is useful if you are doing a task that can take a considerable amount of time to process. You can use this to extend the visibility
* of the message until you have finished processing the message.
*
* @param visibilityExtensionInSeconds the amount of time in seconds the message should not be visible from the queue
* @return a future for when the beat has been acknowledged
*/
Future<?> extend(int visibilityExtensionInSeconds);
}