Skip to content

Commit a81119b

Browse files
committed
ResponseCOnfiguration construction updated
1 parent d2e59b9 commit a81119b

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

services/sqs/src/main/java/software/amazon/awssdk/services/sqs/internal/batchmanager/DefaultSqsAsyncBatchManager.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ private DefaultSqsAsyncBatchManager(DefaultBuilder builder) {
7575
);
7676

7777
this.receiveMessageBatchManager =
78-
new ReceiveMessageBatchManager(client, scheduledExecutor, builder.overrideConfiguration);
78+
new ReceiveMessageBatchManager(client,
79+
scheduledExecutor,
80+
ResponseBatchConfiguration.builder(builder.overrideConfiguration).build());
7981
}
8082

8183
@Override

services/sqs/src/main/java/software/amazon/awssdk/services/sqs/internal/batchmanager/ReceiveMessageBatchManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ public class ReceiveMessageBatchManager implements SdkAutoCloseable {
3939

4040
public ReceiveMessageBatchManager(SqsAsyncClient sqsClient,
4141
ScheduledExecutorService executor,
42-
BatchOverrideConfiguration config) {
42+
ResponseBatchConfiguration config) {
4343
this.sqsClient = sqsClient;
4444
this.executor = executor;
45-
this.config = ResponseBatchConfiguration.builder(config).build();
45+
this.config = config;
4646

4747

4848
}

services/sqs/src/test/java/software/amazon/awssdk/services/sqs/batchmanager/ReceiveMessageBatchManagerTest.java

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
import java.util.concurrent.CompletableFuture;
4848
import java.util.concurrent.ScheduledExecutorService;
4949

50-
import static org.junit.jupiter.api.Assertions.assertTrue;
5150
import static org.mockito.ArgumentMatchers.any;
5251
import static org.mockito.Mockito.*;
5352

@@ -60,24 +59,23 @@ class ReceiveMessageBatchManagerTest {
6059

6160
private final ScheduledExecutorService executor = Executors.newScheduledThreadPool(4);
6261

63-
6462
private ReceiveMessageBatchManager receiveMessageBatchManager;
6563

6664

6765
@ParameterizedTest(name = "{index} => {0}")
6866
@MethodSource("provideBatchOverrideConfigurations")
6967
@DisplayName("Test BatchRequest with various configurations")
7068
void testBatchRequest_WhenBufferingDisabledAndInCompatible_ShouldNotUseBatchManager(String testCaseName,
71-
BatchOverrideConfiguration overrideConfig,
69+
ResponseBatchConfiguration overrideConfig,
7270
ReceiveMessageRequest request,
7371
boolean useBatchManager) throws Exception {
7472

7573
// Initialize the ResponseBatchConfiguration and ReceiveMessageBatchManager
7674
ResponseBatchConfiguration config = ResponseBatchConfiguration.builder()
77-
.messageSystemAttributeNames(overrideConfig.receiveMessageSystemAttributeNames())
75+
.messageSystemAttributeNames(overrideConfig.messageSystemAttributeNames())
7876
.receiveMessageAttributeNames(overrideConfig.receiveMessageAttributeNames())
79-
.visibilityTimeout(overrideConfig.receiveMessageVisibilityTimeout())
80-
.messageMinWaitDuration(overrideConfig.receiveMessageMinWaitDuration()).build();
77+
.visibilityTimeout(overrideConfig.visibilityTimeout())
78+
.messageMinWaitDuration(overrideConfig.messageMinWaitDuration()).build();
8179

8280
receiveMessageBatchManager = new ReceiveMessageBatchManager(sqsClient, executor, overrideConfig);
8381

@@ -122,9 +120,9 @@ private static Stream<Arguments> provideBatchOverrideConfigurations() {
122120
return Stream.of(
123121
Arguments.of(
124122
"Buffering enabled, compatible system and message attributes, and no visibility timeout",
125-
BatchOverrideConfiguration.builder()
123+
ResponseBatchConfiguration.builder()
126124
.receiveMessageAttributeNames(Collections.singletonList("attr1"))
127-
.receiveMessageSystemAttributeNames(Collections.singletonList(MessageSystemAttributeName.SENDER_ID))
125+
.messageSystemAttributeNames(Collections.singletonList(MessageSystemAttributeName.SENDER_ID))
128126
.build(),
129127
ReceiveMessageRequest.builder()
130128
.queueUrl("testQueueUrl")
@@ -135,9 +133,9 @@ private static Stream<Arguments> provideBatchOverrideConfigurations() {
135133
),
136134
Arguments.of(
137135
"Buffering , compatible attributes, and no visibility timeout",
138-
BatchOverrideConfiguration.builder()
136+
ResponseBatchConfiguration.builder()
139137
.receiveMessageAttributeNames(Collections.singletonList("attr1"))
140-
.receiveMessageSystemAttributeNames(Collections.singletonList(MessageSystemAttributeName.SENDER_ID))
138+
.messageSystemAttributeNames(Collections.singletonList(MessageSystemAttributeName.SENDER_ID))
141139
.build(),
142140
ReceiveMessageRequest.builder()
143141
.queueUrl("testQueueUrl")
@@ -150,9 +148,9 @@ private static Stream<Arguments> provideBatchOverrideConfigurations() {
150148
),
151149
Arguments.of(
152150
"Buffering disabled, incompatible system attributes, and no visibility timeout",
153-
BatchOverrideConfiguration.builder()
151+
ResponseBatchConfiguration.builder()
154152
.receiveMessageAttributeNames(Collections.singletonList("attr1"))
155-
.receiveMessageSystemAttributeNames(Collections.singletonList(MessageSystemAttributeName.SENT_TIMESTAMP))
153+
.messageSystemAttributeNames(Collections.singletonList(MessageSystemAttributeName.SENT_TIMESTAMP))
156154
.build(),
157155
ReceiveMessageRequest.builder()
158156
.queueUrl("testQueueUrl")
@@ -164,9 +162,9 @@ private static Stream<Arguments> provideBatchOverrideConfigurations() {
164162
),
165163
Arguments.of(
166164
"Buffering disabled, compatible attributes, but visibility timeout is set",
167-
BatchOverrideConfiguration.builder()
165+
ResponseBatchConfiguration.builder()
168166
.receiveMessageAttributeNames(Collections.singletonList("attr1"))
169-
.receiveMessageSystemAttributeNames(Collections.singletonList(MessageSystemAttributeName.SENDER_ID))
167+
.messageSystemAttributeNames(Collections.singletonList(MessageSystemAttributeName.SENDER_ID))
170168
.build(),
171169
ReceiveMessageRequest.builder()
172170
.queueUrl("testQueueUrl")
@@ -178,9 +176,9 @@ private static Stream<Arguments> provideBatchOverrideConfigurations() {
178176
),
179177
Arguments.of(
180178
"Buffering disabled, compatible attributes, no visibility timeout, but request has attribute names",
181-
BatchOverrideConfiguration.builder()
179+
ResponseBatchConfiguration.builder()
182180
.receiveMessageAttributeNames(Collections.singletonList("attr1"))
183-
.receiveMessageSystemAttributeNames(Collections.singletonList(MessageSystemAttributeName.SENDER_ID))
181+
.messageSystemAttributeNames(Collections.singletonList(MessageSystemAttributeName.SENDER_ID))
184182
.build(),
185183
ReceiveMessageRequest.builder()
186184
.queueUrl("testQueueUrl")
@@ -192,8 +190,8 @@ private static Stream<Arguments> provideBatchOverrideConfigurations() {
192190
),
193191
Arguments.of(
194192
"Buffering enabled, with messageSystemAttributeName in Config and simple ReceiveMessageRequest",
195-
BatchOverrideConfiguration.builder()
196-
.receiveMessageSystemAttributeNames(Collections.singletonList(MessageSystemAttributeName.SENDER_ID))
193+
ResponseBatchConfiguration.builder()
194+
.messageSystemAttributeNames(Collections.singletonList(MessageSystemAttributeName.SENDER_ID))
197195
.build(),
198196
ReceiveMessageRequest.builder()
199197
.queueUrl("testQueueUrl")

0 commit comments

Comments
 (0)