38
38
public final class BatchOverrideConfiguration implements ToCopyableBuilder <BatchOverrideConfiguration .Builder ,
39
39
BatchOverrideConfiguration > {
40
40
41
- private final Integer outboundBatchSizeLimit ;
42
- private final Duration outboundBatchWindowDuration ;
41
+ private final Integer maxBatchSize ;
42
+ private final Duration sendRequestFrequency ;
43
43
private final Duration receiveMessageVisibilityTimeout ;
44
- private final Duration receiveMessageLongPollWaitDuration ;
45
44
private final Duration receiveMessageMinWaitTime ;
46
45
private final List <MessageSystemAttributeName > receiveMessageSystemAttributeNames ;
47
46
private final List <String > receiveMessageAttributeNames ;
48
47
49
48
50
49
private BatchOverrideConfiguration (Builder builder ) {
51
- this .outboundBatchSizeLimit = Validate .isPositiveOrNull (builder .outboundBatchSizeLimit ,
52
- "outboundBatchSizeLimit " );
53
- Validate .isTrue (this .outboundBatchSizeLimit == null || this .outboundBatchSizeLimit <= 10 ,
50
+ this .maxBatchSize = Validate .isPositiveOrNull (builder .maxBatchSize ,
51
+ "maxBatchSize " );
52
+ Validate .isTrue (this .maxBatchSize == null || this .maxBatchSize <= 10 ,
54
53
"A batch can contain up to 10 messages." );
55
54
56
- this .outboundBatchWindowDuration = Validate .isPositiveOrNull (builder .outboundBatchWindowDuration ,
57
- "outboundBatchWindowDuration " );
55
+ this .sendRequestFrequency = Validate .isPositiveOrNull (builder .sendRequestFrequency ,
56
+ "sendRequestFrequency " );
58
57
this .receiveMessageVisibilityTimeout = Validate .isPositiveOrNull (builder .receiveMessageVisibilityTimeout ,
59
58
"receiveMessageVisibilityTimeout" );
60
- this .receiveMessageLongPollWaitDuration = Validate .isPositiveOrNull (builder .receiveMessageLongPollWaitDuration ,
61
- "receiveMessageLongPollWaitDuration" );
59
+
62
60
this .receiveMessageMinWaitTime = Validate .isPositiveOrNull (builder .receiveMessageMinWaitTime ,
63
61
"receiveMessageMinWaitTime" );
64
62
@@ -81,16 +79,16 @@ public static Builder builder() {
81
79
* A batch can contain up to a maximum of 10 messages.
82
80
* The default value is 10.
83
81
*/
84
- public Integer outboundBatchSizeLimit () {
85
- return outboundBatchSizeLimit ;
82
+ public Integer maxBatchSize () {
83
+ return maxBatchSize ;
86
84
}
87
85
88
86
/**
89
87
* @return the maximum amount of time that an outgoing call waits to be batched with messages of the same type.
90
88
* The default value is 200 milliseconds.
91
89
*/
92
- public Duration outboundBatchWindowDuration () {
93
- return outboundBatchWindowDuration ;
90
+ public Duration sendRequestFrequency () {
91
+ return sendRequestFrequency ;
94
92
}
95
93
96
94
/**
@@ -100,14 +98,6 @@ public Duration receiveMessageVisibilityTimeout() {
100
98
return receiveMessageVisibilityTimeout ;
101
99
}
102
100
103
- /**
104
- * @return the amount of time the receive call will block on the server, waiting for messages to arrive if the
105
- * queue is empty when the call is initially made.
106
- */
107
- public Duration receiveMessageLongPollWaitDuration () {
108
- return receiveMessageLongPollWaitDuration ;
109
- }
110
-
111
101
/**
112
102
* @return the minimum wait time for incoming receive message requests.
113
103
*/
@@ -135,10 +125,9 @@ public List<String> receiveMessageAttributeNames() {
135
125
@ Override
136
126
public Builder toBuilder () {
137
127
return new Builder ()
138
- .outboundBatchSizeLimit ( outboundBatchSizeLimit )
139
- .outboundBatchWindowDuration ( outboundBatchWindowDuration )
128
+ .maxBatchSize ( maxBatchSize )
129
+ .sendRequestFrequency ( sendRequestFrequency )
140
130
.receiveMessageVisibilityTimeout (receiveMessageVisibilityTimeout )
141
- .receiveMessageLongPollWaitDuration (receiveMessageLongPollWaitDuration )
142
131
.receiveMessageMinWaitTime (receiveMessageMinWaitTime )
143
132
.receiveMessageSystemAttributeNames (receiveMessageSystemAttributeNames )
144
133
.receiveMessageAttributeNames (receiveMessageAttributeNames );
@@ -148,10 +137,9 @@ public Builder toBuilder() {
148
137
@ Override
149
138
public String toString () {
150
139
return ToString .builder ("BatchOverrideConfiguration" )
151
- .add ("outboundBatchSizeLimit " , outboundBatchSizeLimit )
152
- .add ("outboundBatchWindowDuration " , outboundBatchWindowDuration )
140
+ .add ("maxBatchSize " , maxBatchSize )
141
+ .add ("sendRequestFrequency " , sendRequestFrequency )
153
142
.add ("receiveMessageVisibilityTimeout" , receiveMessageVisibilityTimeout )
154
- .add ("receiveMessageLongPollWaitDuration" , receiveMessageLongPollWaitDuration )
155
143
.add ("receiveMessageMinWaitTime" , receiveMessageMinWaitTime )
156
144
.add ("receiveMessageSystemAttributeNames" , receiveMessageSystemAttributeNames )
157
145
.add ("receiveMessageAttributeNames" , receiveMessageAttributeNames )
@@ -169,21 +157,17 @@ public boolean equals(Object o) {
169
157
170
158
BatchOverrideConfiguration that = (BatchOverrideConfiguration ) o ;
171
159
172
- if (outboundBatchSizeLimit != null ? !outboundBatchSizeLimit .equals (that .outboundBatchSizeLimit ) : that .outboundBatchSizeLimit != null ) {
160
+ if (maxBatchSize != null ? !maxBatchSize .equals (that .maxBatchSize ) : that .maxBatchSize != null ) {
173
161
return false ;
174
162
}
175
- if (outboundBatchWindowDuration != null ? !outboundBatchWindowDuration .equals (that .outboundBatchWindowDuration ) :
176
- that .outboundBatchWindowDuration != null ) {
163
+ if (sendRequestFrequency != null ? !sendRequestFrequency .equals (that .sendRequestFrequency ) :
164
+ that .sendRequestFrequency != null ) {
177
165
return false ;
178
166
}
179
167
if (receiveMessageVisibilityTimeout != null ? !receiveMessageVisibilityTimeout .equals (that .receiveMessageVisibilityTimeout ) :
180
168
that .receiveMessageVisibilityTimeout != null ) {
181
169
return false ;
182
170
}
183
- if (receiveMessageLongPollWaitDuration != null ? !receiveMessageLongPollWaitDuration .equals (that .receiveMessageLongPollWaitDuration ) :
184
- that .receiveMessageLongPollWaitDuration != null ) {
185
- return false ;
186
- }
187
171
if (receiveMessageMinWaitTime != null ? !receiveMessageMinWaitTime .equals (that .receiveMessageMinWaitTime ) :
188
172
that .receiveMessageMinWaitTime != null ) {
189
173
return false ;
@@ -198,10 +182,9 @@ public boolean equals(Object o) {
198
182
199
183
@ Override
200
184
public int hashCode () {
201
- int result = outboundBatchSizeLimit != null ? outboundBatchSizeLimit .hashCode () : 0 ;
202
- result = 31 * result + (outboundBatchWindowDuration != null ? outboundBatchWindowDuration .hashCode () : 0 );
185
+ int result = maxBatchSize != null ? maxBatchSize .hashCode () : 0 ;
186
+ result = 31 * result + (sendRequestFrequency != null ? sendRequestFrequency .hashCode () : 0 );
203
187
result = 31 * result + (receiveMessageVisibilityTimeout != null ? receiveMessageVisibilityTimeout .hashCode () : 0 );
204
- result = 31 * result + (receiveMessageLongPollWaitDuration != null ? receiveMessageLongPollWaitDuration .hashCode () : 0 );
205
188
result = 31 * result + (receiveMessageMinWaitTime != null ? receiveMessageMinWaitTime .hashCode () : 0 );
206
189
result = 31 * result + (receiveMessageSystemAttributeNames != null ? receiveMessageSystemAttributeNames .hashCode () : 0 );
207
190
result = 31 * result + (receiveMessageAttributeNames != null ? receiveMessageAttributeNames .hashCode () : 0 );
@@ -210,10 +193,9 @@ public int hashCode() {
210
193
211
194
public static final class Builder implements CopyableBuilder <Builder , BatchOverrideConfiguration > {
212
195
213
- private Integer outboundBatchSizeLimit = 10 ;
214
- private Duration outboundBatchWindowDuration = Duration .ofMillis (200 );
196
+ private Integer maxBatchSize = 10 ;
197
+ private Duration sendRequestFrequency = Duration .ofMillis (200 );
215
198
private Duration receiveMessageVisibilityTimeout ;
216
- private Duration receiveMessageLongPollWaitDuration ;
217
199
private Duration receiveMessageMinWaitTime = Duration .ofMillis (50 );
218
200
private List <MessageSystemAttributeName > receiveMessageSystemAttributeNames = Collections .emptyList ();
219
201
private List <String > receiveMessageAttributeNames = Collections .emptyList ();
@@ -228,28 +210,29 @@ private Builder() {
228
210
* and {@link DeleteMessageBatchRequest}.
229
211
* A batch can contain up to a maximum of 10 messages. The default value is 10.
230
212
*
231
- * @param outboundBatchSizeLimit The maximum number of items to be batched together in a single request.
213
+ * @param maxBatchSize The maximum number of items to be batched together in a single request.
232
214
* @return This Builder object for method chaining.
233
215
*/
234
- public Builder outboundBatchSizeLimit (Integer outboundBatchSizeLimit ) {
235
- this .outboundBatchSizeLimit = outboundBatchSizeLimit ;
216
+ public Builder maxBatchSize (Integer maxBatchSize ) {
217
+ this .maxBatchSize = maxBatchSize ;
236
218
return this ;
237
219
}
238
220
239
221
/**
240
- * Specifies the maximum duration that an outbound batch is held open for additional outbound requests
241
- * before being sent. Outbound requests include {@link SendMessageBatchRequest},
242
- * {@link ChangeMessageVisibilityBatchRequest}, and {@link DeleteMessageBatchRequest}. If the
243
- * {@link #outboundBatchSizeLimit} is reached before this duration, the batch will be sent immediately.
244
- * The longer this duration, the more time messages have to be added to the batch, which can reduce the
245
- * number of calls made and increase throughput, but it may also increase average message latency.
246
- * The default value is 200 milliseconds.
222
+ * Specifies the frequency at which outbound batches are sent.
223
+ * This defines the maximum duration that an outbound batch is held open for additional outbound
224
+ * requests before being sent. Outbound requests include SendMessageBatchRequest,
225
+ * ChangeMessageVisibilityBatchRequest, and DeleteMessageBatchRequest. If the maxBatchSize is reached
226
+ * before this duration, the batch will be sent immediately.
227
+ * Increasing the {@code sendRequestFrequency} gives more time for additional messages to be added to
228
+ * the batch, which can reduce the number of requests and increase throughput. However, a higher
229
+ * frequency may also result in increased average message latency. The default value is 200 milliseconds.
247
230
*
248
- * @param outboundBatchWindowDuration The new outboundBatchWindowDuration value.
231
+ * @param sendRequestFrequency The new value for the frequency at which outbound requests are sent .
249
232
* @return This Builder object for method chaining.
250
233
*/
251
- public Builder outboundBatchWindowDuration (Duration outboundBatchWindowDuration ) {
252
- this .outboundBatchWindowDuration = outboundBatchWindowDuration ;
234
+ public Builder sendRequestFrequency (Duration sendRequestFrequency ) {
235
+ this .sendRequestFrequency = sendRequestFrequency ;
253
236
return this ;
254
237
}
255
238
@@ -266,19 +249,6 @@ public Builder receiveMessageVisibilityTimeout(Duration receiveMessageVisibility
266
249
return this ;
267
250
}
268
251
269
- /**
270
- * Specifies the amount of time the receive call will block on the server waiting for messages to arrive if the
271
- * queue is empty when the receive call is first made. By default, this value is not set, meaning no long
272
- * polling wait time on the server side.
273
- *
274
- * @param receiveMessageLongPollWaitDuration The new longPollWaitTimeout value.
275
- * @return This Builder object for method chaining.
276
- */
277
- public Builder receiveMessageLongPollWaitDuration (Duration receiveMessageLongPollWaitDuration ) {
278
- this .receiveMessageLongPollWaitDuration = receiveMessageLongPollWaitDuration ;
279
- return this ;
280
- }
281
-
282
252
/**
283
253
* Configures the minimum wait time for incoming receive message requests. The default value is 50 milliseconds.
284
254
* Without a non-zero minimum wait time, threads can easily waste CPU time by busy-waiting against empty local buffers.
0 commit comments