File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
main/java/com/amazon/sqs/javamessaging
test/java/com/amazon/sqs/javamessaging Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change 54
54
* This runs until the message consumer is closed and in-progress SQS
55
55
* <code>receiveMessage</code> call returns.
56
56
* <P>
57
- * Uses SQS <code>receiveMessage</code> with long-poll wait time of 20 seconds.
57
+ * Uses SQS <code>receiveMessage</code> with long-poll wait time of WAIT_TIME_SECONDS (default to 20) seconds.
58
58
* <P>
59
59
* Add re-tries on top of <code>SqsClient</code> re-tries on SQS calls.
60
60
*/
61
61
public class SQSMessageConsumerPrefetch implements Runnable , PrefetchManager {
62
62
63
63
private static final Logger LOG = LoggerFactory .getLogger (SQSMessageConsumerPrefetch .class );
64
64
65
- protected static final int WAIT_TIME_SECONDS = 20 ;
65
+ protected static int WAIT_TIME_SECONDS = 20 ;
66
66
67
67
protected static final String ALL = "All" ;
68
68
Original file line number Diff line number Diff line change
1
+ package com .amazon .sqs .javamessaging ;
2
+
3
+ import org .junit .jupiter .api .DisplayName ;
4
+ import org .junit .jupiter .api .Test ;
5
+
6
+ import java .lang .reflect .Field ;
7
+
8
+ import static org .junit .jupiter .api .Assertions .*;
9
+
10
+ class ModifyWaitTimeSecondsTest {
11
+ @ DisplayName ("Should be able to modify SQSMessageConsumerPrefetch.WAIT_TIME_SECONDS via Reflection" )
12
+ @ Test
13
+ void WaitTimeSecondsShouldBeModifiableViaReflection () throws NoSuchFieldException , IllegalAccessException {
14
+ Field wait_time_seconds = SQSMessageConsumerPrefetch .class .getDeclaredField ("WAIT_TIME_SECONDS" );
15
+ wait_time_seconds .setAccessible (true );
16
+ wait_time_seconds .setInt (null ,5 );
17
+ assertEquals (5 ,SQSMessageConsumerPrefetch .WAIT_TIME_SECONDS );
18
+ }
19
+ }
You can’t perform that action at this time.
0 commit comments