Skip to content

Commit 387ff0e

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

File tree

1 file changed

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

1 file changed

+94
-3
lines changed

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

Lines changed: 94 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@
1717

1818
import io.awspring.cloud.autoconfigure.AwsClientProperties;
1919
import io.awspring.cloud.sqs.listener.QueueNotFoundStrategy;
20-
import java.time.Duration;
2120
import org.springframework.boot.context.properties.ConfigurationProperties;
2221
import org.springframework.lang.Nullable;
22+
import software.amazon.awssdk.services.sqs.model.MessageSystemAttributeName;
23+
24+
import java.time.Duration;
25+
import java.util.List;
2326

2427
/**
2528
* Properties related to AWS SQS.
@@ -79,8 +82,9 @@ public void setObservationEnabled(Boolean observationEnabled) {
7982
public static class Listener {
8083

8184
/**
82-
* The maximum concurrent messages that can be processed simultaneously for each queue. Note that if
83-
* acknowledgement batching is being used, the actual maximum number of messages inflight might be higher.
85+
* The maximum concurrent messages that can be processed simultaneously for each
86+
* queue. Note that if acknowledgement batching is being used, the actual maximum
87+
* number of messages inflight might be higher.
8488
*/
8589
@Nullable
8690
private Integer maxConcurrentMessages;
@@ -138,6 +142,93 @@ public Duration getMaxDelayBetweenPolls() {
138142
public void setMaxDelayBetweenPolls(Duration maxDelayBetweenPolls) {
139143
this.maxDelayBetweenPolls = maxDelayBetweenPolls;
140144
}
145+
146+
}
147+
148+
public static class Batch {
149+
150+
/**
151+
* The maximum number of messages that can be processed in a single batch. The
152+
* maximum is 10.
153+
*/
154+
private Integer maxNumberOfMessages;
155+
156+
/**
157+
* The frequency at which requests are sent to SQS when processing messages in a
158+
* batch.
159+
*/
160+
private Duration sendBatchFrequency;
161+
162+
/**
163+
* The visibility timeout to set for messages received in a batch. If unset, the
164+
* queue default is used.
165+
*/
166+
private Duration visibilityTimeout;
167+
168+
/**
169+
* The minimum wait duration for a receiveMessage request in a batch. To avoid
170+
* unnecessary CPU usage, do not set this value to 0.
171+
*/
172+
private Duration waitTimeSeconds;
173+
174+
/**
175+
* The list of system attribute names to request for receiveMessage calls.
176+
*/
177+
private List<MessageSystemAttributeName> systemAttributeNames;
178+
179+
/**
180+
* The list of attribute names to request for receiveMessage calls.
181+
*/
182+
private List<String> attributeNames;
183+
184+
public Integer getMaxNumberOfMessages() {
185+
return maxNumberOfMessages;
186+
}
187+
188+
public void setMaxNumberOfMessages(Integer maxNumberOfMessages) {
189+
this.maxNumberOfMessages = maxNumberOfMessages;
190+
}
191+
192+
public Duration getSendBatchFrequency() {
193+
return sendBatchFrequency;
194+
}
195+
196+
public void setSendBatchFrequency(Duration sendBatchFrequency) {
197+
this.sendBatchFrequency = sendBatchFrequency;
198+
}
199+
200+
public Duration getVisibilityTimeout() {
201+
return visibilityTimeout;
202+
}
203+
204+
public void setVisibilityTimeout(Duration visibilityTimeout) {
205+
this.visibilityTimeout = visibilityTimeout;
206+
}
207+
208+
public Duration getWaitTimeSeconds() {
209+
return waitTimeSeconds;
210+
}
211+
212+
public void setWaitTimeSeconds(Duration waitTimeSeconds) {
213+
this.waitTimeSeconds = waitTimeSeconds;
214+
}
215+
216+
public List<MessageSystemAttributeName> getSystemAttributeNames() {
217+
return systemAttributeNames;
218+
}
219+
220+
public void setSystemAttributeNames(List<MessageSystemAttributeName> systemAttributeNames) {
221+
this.systemAttributeNames = systemAttributeNames;
222+
}
223+
224+
public List<String> getAttributeNames() {
225+
return attributeNames;
226+
}
227+
228+
public void setAttributeNames(List<String> attributeNames) {
229+
this.attributeNames = attributeNames;
230+
}
231+
141232
}
142233

143234
}

0 commit comments

Comments
 (0)