Skip to content

Commit a34831b

Browse files
committed
feat: add batch processing configuration to SQS properties
1 parent 387ff0e commit a34831b

File tree

1 file changed

+36
-0
lines changed
  • spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/sqs

1 file changed

+36
-0
lines changed

spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/sqs/SqsProperties.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public class SqsProperties extends AwsClientProperties {
4141

4242
private Listener listener = new Listener();
4343

44+
private Batch batch = new Batch();
45+
4446
public Listener getListener() {
4547
return this.listener;
4648
}
@@ -49,6 +51,14 @@ public void setListener(Listener listener) {
4951
this.listener = listener;
5052
}
5153

54+
public Batch getBatch() {
55+
return batch;
56+
}
57+
58+
public void setBatch(Batch batch) {
59+
this.batch = batch;
60+
}
61+
5262
@Nullable
5363
private QueueNotFoundStrategy queueNotFoundStrategy;
5464

@@ -147,40 +157,61 @@ public void setMaxDelayBetweenPolls(Duration maxDelayBetweenPolls) {
147157

148158
public static class Batch {
149159

160+
/**
161+
* Enables SQS automatic batching using AWS SDK's SqsAsyncBatchManager.
162+
*/
163+
private boolean enabled = false;
164+
150165
/**
151166
* The maximum number of messages that can be processed in a single batch. The
152167
* maximum is 10.
153168
*/
169+
@Nullable
154170
private Integer maxNumberOfMessages;
155171

156172
/**
157173
* The frequency at which requests are sent to SQS when processing messages in a
158174
* batch.
159175
*/
176+
@Nullable
160177
private Duration sendBatchFrequency;
161178

162179
/**
163180
* The visibility timeout to set for messages received in a batch. If unset, the
164181
* queue default is used.
165182
*/
183+
@Nullable
166184
private Duration visibilityTimeout;
167185

168186
/**
169187
* The minimum wait duration for a receiveMessage request in a batch. To avoid
170188
* unnecessary CPU usage, do not set this value to 0.
171189
*/
190+
@Nullable
172191
private Duration waitTimeSeconds;
173192

174193
/**
175194
* The list of system attribute names to request for receiveMessage calls.
176195
*/
196+
@Nullable
177197
private List<MessageSystemAttributeName> systemAttributeNames;
178198

179199
/**
180200
* The list of attribute names to request for receiveMessage calls.
181201
*/
202+
@Nullable
182203
private List<String> attributeNames;
183204

205+
@Nullable
206+
public Boolean getEnabled() {
207+
return enabled;
208+
}
209+
210+
public void setEnabled(Boolean enabled) {
211+
this.enabled = enabled;
212+
}
213+
214+
@Nullable
184215
public Integer getMaxNumberOfMessages() {
185216
return maxNumberOfMessages;
186217
}
@@ -189,6 +220,7 @@ public void setMaxNumberOfMessages(Integer maxNumberOfMessages) {
189220
this.maxNumberOfMessages = maxNumberOfMessages;
190221
}
191222

223+
@Nullable
192224
public Duration getSendBatchFrequency() {
193225
return sendBatchFrequency;
194226
}
@@ -197,6 +229,7 @@ public void setSendBatchFrequency(Duration sendBatchFrequency) {
197229
this.sendBatchFrequency = sendBatchFrequency;
198230
}
199231

232+
@Nullable
200233
public Duration getVisibilityTimeout() {
201234
return visibilityTimeout;
202235
}
@@ -205,6 +238,7 @@ public void setVisibilityTimeout(Duration visibilityTimeout) {
205238
this.visibilityTimeout = visibilityTimeout;
206239
}
207240

241+
@Nullable
208242
public Duration getWaitTimeSeconds() {
209243
return waitTimeSeconds;
210244
}
@@ -213,6 +247,7 @@ public void setWaitTimeSeconds(Duration waitTimeSeconds) {
213247
this.waitTimeSeconds = waitTimeSeconds;
214248
}
215249

250+
@Nullable
216251
public List<MessageSystemAttributeName> getSystemAttributeNames() {
217252
return systemAttributeNames;
218253
}
@@ -221,6 +256,7 @@ public void setSystemAttributeNames(List<MessageSystemAttributeName> systemAttri
221256
this.systemAttributeNames = systemAttributeNames;
222257
}
223258

259+
@Nullable
224260
public List<String> getAttributeNames() {
225261
return attributeNames;
226262
}

0 commit comments

Comments
 (0)