@@ -36,30 +36,27 @@ public final class BatchOverrideConfiguration implements ToCopyableBuilder<Batch
36
36
private final Integer maxBatchItems ;
37
37
private final Integer maxBatchKeys ;
38
38
private final Integer maxBufferSize ;
39
- private final Duration maxBatchOpenInMs ;
39
+ private final Duration maxBatchOpenDuration ;
40
40
private final Duration visibilityTimeout ;
41
- private final Integer longPollWaitTimeoutSeconds ;
42
- private final Duration minReceiveWaitTimeMs ;
41
+ private final Duration longPollWaitTimeout ;
42
+ private final Duration minReceiveWaitTime ;
43
43
private final Integer maxDoneReceiveBatches ;
44
44
private final List <String > receiveAttributeNames ;
45
45
private final List <String > receiveMessageAttributeNames ;
46
46
private final Boolean adaptivePrefetching ;
47
47
private final Integer maxInflightReceiveBatches ;
48
- private final Boolean longPoll ;
49
48
50
49
public BatchOverrideConfiguration (Builder builder ) {
51
50
this .maxBatchItems = Validate .isPositiveOrNull (builder .maxBatchItems , "maxBatchItems" );
52
51
this .maxBatchKeys = Validate .isPositiveOrNull (builder .maxBatchKeys , "maxBatchKeys" );
53
52
this .maxBufferSize = Validate .isPositiveOrNull (builder .maxBufferSize , "maxBufferSize" );
54
- this .maxBatchOpenInMs = Validate .isPositiveOrNull (builder .maxBatchOpenInMs , "maxBatchOpenInMs" );
55
- this .visibilityTimeout = Validate .isPositiveOrNull (builder .visibilityTimeout , "visibilityTimeoutSeconds" );
56
- this .longPollWaitTimeoutSeconds = Validate .isPositiveOrNull (builder .longPollWaitTimeoutSeconds ,
57
- "longPollWaitTimeoutSeconds" );
58
- this .minReceiveWaitTimeMs = Validate .isPositiveOrNull (builder .minReceiveWaitTimeMs , "minReceiveWaitTimeMs" );
53
+ this .maxBatchOpenDuration = Validate .isPositiveOrNull (builder .maxBatchOpenDuration , "maxBatchOpenDuration" );
54
+ this .visibilityTimeout = Validate .isPositiveOrNull (builder .visibilityTimeout , "visibilityTimeout" );
55
+ this .longPollWaitTimeout = Validate .isPositiveOrNull (builder .longPollWaitTimeout , "longPollWaitTimeout" );
56
+ this .minReceiveWaitTime = Validate .isPositiveOrNull (builder .minReceiveWaitTime , "minReceiveWaitTime" );
59
57
this .receiveAttributeNames = builder .receiveAttributeNames ;
60
58
this .receiveMessageAttributeNames = builder .receiveMessageAttributeNames ;
61
59
this .adaptivePrefetching = builder .adaptivePrefetching ;
62
- this .longPoll = builder .longPoll ;
63
60
this .maxInflightReceiveBatches = builder .maxInflightReceiveBatches ;
64
61
this .maxDoneReceiveBatches = builder .maxDoneReceiveBatches ;
65
62
}
@@ -94,11 +91,10 @@ public Optional<Integer> maxDoneReceiveBatches() {
94
91
}
95
92
96
93
/**
97
- * @return the optional maximum amount of time (in milliseconds) that an outgoing call waits to be batched with messages of
98
- * the same type.
94
+ * @return the optional maximum amount of time that an outgoing call waits to be batched with messages of the same type.
99
95
*/
100
- public Optional <Duration > maxBatchOpenInMs () {
101
- return Optional .ofNullable (maxBatchOpenInMs );
96
+ public Optional <Duration > maxBatchOpenDuration () {
97
+ return Optional .ofNullable (maxBatchOpenDuration );
102
98
}
103
99
104
100
/**
@@ -109,32 +105,34 @@ public Optional<Duration> visibilityTimeout() {
109
105
}
110
106
111
107
/**
112
- * @return the amount of time, in seconds, the receive call will block on the server waiting for messages to arrive if the
108
+ * @return the amount of time, the receive call will block on the server waiting for messages to arrive if the
113
109
* queue is empty when the receive call is first made.
114
110
*/
115
- public Optional <Integer > longPollWaitTimeoutSeconds () {
116
- return Optional .ofNullable (longPollWaitTimeoutSeconds );
111
+ public Optional <Duration > longPollWaitTimeout () {
112
+ return Optional .ofNullable (longPollWaitTimeout );
117
113
}
118
114
119
115
/**
120
116
* @return the minimum wait time for incoming receive message requests.
121
117
*/
122
- public Optional <Duration > minReceiveWaitTimeMs () {
123
- return Optional .ofNullable (minReceiveWaitTimeMs );
118
+ public Optional <Duration > minReceiveWaitTime () {
119
+ return Optional .ofNullable (minReceiveWaitTime );
124
120
}
125
121
126
122
/**
127
123
* @return the attributes receive calls will request.
128
124
*/
129
125
public Optional <List <String >> receiveAttributeNames () {
130
- return Optional .ofNullable (receiveAttributeNames );
126
+ return Optional .ofNullable (receiveAttributeNames )
127
+ .map (Collections ::unmodifiableList );
131
128
}
132
129
133
130
/**
134
131
* @return the message attributes receive calls will request.
135
132
*/
136
133
public Optional <List <String >> receiveMessageAttributeNames () {
137
- return Optional .ofNullable (receiveMessageAttributeNames );
134
+ return Optional .ofNullable (receiveMessageAttributeNames )
135
+ .map (Collections ::unmodifiableList );
138
136
}
139
137
140
138
/**
@@ -144,13 +142,6 @@ public Optional<Boolean> adaptivePrefetching() {
144
142
return Optional .ofNullable (adaptivePrefetching );
145
143
}
146
144
147
- /**
148
- * @return the option for long polling.
149
- */
150
- public Optional <Boolean > longPoll () {
151
- return Optional .ofNullable (longPoll );
152
- }
153
-
154
145
/**
155
146
* @return the maximum number of concurrent receive message batches.
156
147
*/
@@ -163,16 +154,15 @@ public Builder toBuilder() {
163
154
return new Builder ().maxBatchItems (maxBatchItems )
164
155
.maxBatchKeys (maxBatchKeys )
165
156
.maxBufferSize (maxBufferSize )
166
- .maxBatchOpenInMs ( maxBatchOpenInMs )
157
+ .maxBatchOpenDuration ( maxBatchOpenDuration )
167
158
.visibilityTimeout (visibilityTimeout )
168
- .longPollWaitTimeoutSeconds ( longPollWaitTimeoutSeconds )
169
- .minReceiveWaitTimeMs ( minReceiveWaitTimeMs )
159
+ .longPollWaitTimeout ( longPollWaitTimeout )
160
+ .minReceiveWaitTime ( minReceiveWaitTime )
170
161
.maxInflightReceiveBatches (maxInflightReceiveBatches )
171
162
.receiveAttributeNames (receiveAttributeNames )
172
163
.receiveMessageAttributeNames (receiveMessageAttributeNames )
173
164
.adaptivePrefetching (adaptivePrefetching )
174
- .maxDoneReceiveBatches (maxDoneReceiveBatches )
175
- .longPoll (longPoll );
165
+ .maxDoneReceiveBatches (maxDoneReceiveBatches );
176
166
}
177
167
178
168
@ Override
@@ -181,16 +171,15 @@ public String toString() {
181
171
.add ("maxBatchItems" , maxBatchItems )
182
172
.add ("maxBatchKeys" , maxBatchKeys )
183
173
.add ("maxBufferSize" , maxBufferSize )
184
- .add ("maxBatchOpenInMs " , maxBatchOpenInMs .toMillis ())
185
- .add ("visibilityTimeoutSeconds " , visibilityTimeout )
186
- .add ("longPollWaitTimeoutSeconds " , longPollWaitTimeoutSeconds )
187
- .add ("minReceiveWaitTimeMs " , minReceiveWaitTimeMs )
174
+ .add ("maxBatchOpenDuration " , maxBatchOpenDuration .toMillis ())
175
+ .add ("visibilityTimeout " , visibilityTimeout )
176
+ .add ("longPollWaitTimeout " , longPollWaitTimeout )
177
+ .add ("minReceiveWaitTime " , minReceiveWaitTime )
188
178
.add ("receiveAttributeNames" , receiveAttributeNames )
189
179
.add ("receiveMessageAttributeNames" , receiveMessageAttributeNames )
190
180
.add ("adaptivePrefetching" , adaptivePrefetching )
191
181
.add ("maxInflightReceiveBatches" , maxInflightReceiveBatches )
192
182
.add ("maxDoneReceiveBatches" , maxDoneReceiveBatches )
193
- .add ("longPoll" , longPoll )
194
183
.build ();
195
184
}
196
185
@@ -215,19 +204,19 @@ public boolean equals(Object o) {
215
204
return false ;
216
205
}
217
206
218
- if (maxBatchOpenInMs != null ? !maxBatchOpenInMs .equals (that .maxBatchOpenInMs ) : that .maxBatchOpenInMs != null ) {
207
+ if (maxBatchOpenDuration != null ? !maxBatchOpenDuration .equals (that .maxBatchOpenDuration ) : that .maxBatchOpenDuration != null ) {
219
208
return false ;
220
209
}
221
210
if (visibilityTimeout != null ? !visibilityTimeout .equals (that .visibilityTimeout ) :
222
211
that .visibilityTimeout != null ) {
223
212
return false ;
224
213
}
225
- if (longPollWaitTimeoutSeconds != null ? !longPollWaitTimeoutSeconds .equals (that .longPollWaitTimeoutSeconds ) :
226
- that .longPollWaitTimeoutSeconds != null ) {
214
+ if (longPollWaitTimeout != null ? !longPollWaitTimeout .equals (that .longPollWaitTimeout ) :
215
+ that .longPollWaitTimeout != null ) {
227
216
return false ;
228
217
}
229
- if (minReceiveWaitTimeMs != null ? !minReceiveWaitTimeMs .equals (that .minReceiveWaitTimeMs ) :
230
- that .minReceiveWaitTimeMs != null ) {
218
+ if (minReceiveWaitTime != null ? !minReceiveWaitTime .equals (that .minReceiveWaitTime ) :
219
+ that .minReceiveWaitTime != null ) {
231
220
return false ;
232
221
}
233
222
if (receiveAttributeNames != null ? !receiveAttributeNames .equals (that .receiveAttributeNames ) :
@@ -242,9 +231,6 @@ public boolean equals(Object o) {
242
231
that .adaptivePrefetching != null ) {
243
232
return false ;
244
233
}
245
- if (longPoll != null ? !longPoll .equals (that .longPoll ) : that .longPoll != null ) {
246
- return false ;
247
- }
248
234
if (maxInflightReceiveBatches != null ? !maxInflightReceiveBatches .equals (that .maxInflightReceiveBatches ) :
249
235
that .maxInflightReceiveBatches != null ) {
250
236
return false ;
@@ -258,14 +244,13 @@ public int hashCode() {
258
244
int result = maxBatchItems != null ? maxBatchItems .hashCode () : 0 ;
259
245
result = 31 * result + (maxBatchKeys != null ? maxBatchKeys .hashCode () : 0 );
260
246
result = 31 * result + (maxBufferSize != null ? maxBufferSize .hashCode () : 0 );
261
- result = 31 * result + (maxBatchOpenInMs != null ? maxBatchOpenInMs .hashCode () : 0 );
247
+ result = 31 * result + (maxBatchOpenDuration != null ? maxBatchOpenDuration .hashCode () : 0 );
262
248
result = 31 * result + (visibilityTimeout != null ? visibilityTimeout .hashCode () : 0 );
263
- result = 31 * result + (longPollWaitTimeoutSeconds != null ? longPollWaitTimeoutSeconds .hashCode () : 0 );
264
- result = 31 * result + (minReceiveWaitTimeMs != null ? minReceiveWaitTimeMs .hashCode () : 0 );
249
+ result = 31 * result + (longPollWaitTimeout != null ? longPollWaitTimeout .hashCode () : 0 );
250
+ result = 31 * result + (minReceiveWaitTime != null ? minReceiveWaitTime .hashCode () : 0 );
265
251
result = 31 * result + (receiveAttributeNames != null ? receiveAttributeNames .hashCode () : 0 );
266
252
result = 31 * result + (receiveMessageAttributeNames != null ? receiveMessageAttributeNames .hashCode () : 0 );
267
253
result = 31 * result + (adaptivePrefetching != null ? adaptivePrefetching .hashCode () : 0 );
268
- result = 31 * result + (longPoll != null ? longPoll .hashCode () : 0 );
269
254
result = 31 * result + (maxInflightReceiveBatches != null ? maxInflightReceiveBatches .hashCode () : 0 );
270
255
result = 31 * result + (maxDoneReceiveBatches != null ? maxDoneReceiveBatches .hashCode () : 0 );
271
256
return result ;
@@ -276,16 +261,15 @@ public static final class Builder implements CopyableBuilder<Builder, BatchOverr
276
261
private Integer maxBatchItems ;
277
262
private Integer maxBatchKeys ;
278
263
private Integer maxBufferSize ;
279
- private Duration maxBatchOpenInMs ;
264
+ private Duration maxBatchOpenDuration ;
280
265
private Duration visibilityTimeout ;
281
- private Integer longPollWaitTimeoutSeconds ;
282
- private Duration minReceiveWaitTimeMs ;
266
+ private Duration longPollWaitTimeout ;
267
+ private Duration minReceiveWaitTime ;
283
268
private Integer maxDoneReceiveBatches ;
284
269
private Integer maxInflightReceiveBatches ;
285
270
private List <String > receiveAttributeNames = Collections .emptyList ();
286
271
private List <String > receiveMessageAttributeNames = Collections .emptyList ();
287
272
private Boolean adaptivePrefetching ;
288
- private Boolean longPoll ;
289
273
290
274
private Builder () {
291
275
}
@@ -328,14 +312,14 @@ public Builder maxBufferSize(Integer maxBufferSize) {
328
312
}
329
313
330
314
/**
331
- * Define the maximum amount of time (in milliseconds) that an outgoing call waits for other requests before sending out a
315
+ * Define the maximum amount of time that an outgoing call waits for other requests before sending out a
332
316
* batch request.
333
317
*
334
- * @param maxBatchOpenInMs The new maxBatchOpenInMs value.
318
+ * @param maxBatchOpenDuration The new maxBatchOpenDuration value.
335
319
* @return This object for method chaining.
336
320
*/
337
- public Builder maxBatchOpenInMs (Duration maxBatchOpenInMs ) {
338
- this .maxBatchOpenInMs = maxBatchOpenInMs ;
321
+ public Builder maxBatchOpenDuration (Duration maxBatchOpenDuration ) {
322
+ this .maxBatchOpenDuration = maxBatchOpenDuration ;
339
323
return this ;
340
324
}
341
325
@@ -353,14 +337,14 @@ public Builder visibilityTimeout(Duration visibilityTimeout) {
353
337
}
354
338
355
339
/**
356
- * Define the amount of time, in seconds, the receive call will block on the server waiting for messages to arrive if the
340
+ * Define the amount of time, the receive call will block on the server waiting for messages to arrive if the
357
341
* queue is empty when the receive call is first made. This setting has no effect if long polling is disabled.
358
342
*
359
- * @param longPollWaitTimeoutSeconds The new longPollWaitTimeoutSeconds value.
343
+ * @param longPollWaitTimeout The new longPollWaitTimeout value.
360
344
* @return This object for method chaining.
361
345
*/
362
- public Builder longPollWaitTimeoutSeconds ( Integer longPollWaitTimeoutSeconds ) {
363
- this .longPollWaitTimeoutSeconds = longPollWaitTimeoutSeconds ;
346
+ public Builder longPollWaitTimeout ( Duration longPollWaitTimeout ) {
347
+ this .longPollWaitTimeout = longPollWaitTimeout ;
364
348
return this ;
365
349
}
366
350
@@ -369,11 +353,11 @@ public Builder longPollWaitTimeoutSeconds(Integer longPollWaitTimeoutSeconds) {
369
353
* easily waste CPU time busy-waiting against empty local buffers. Avoid setting this to 0 unless you are confident
370
354
* threads will do useful work in-between each call to receive messages!
371
355
*
372
- * @param minReceiveWaitTimeMs The new minReceiveWaitTimeMs value.
356
+ * @param minReceiveWaitTime The new minReceiveWaitTime value.
373
357
* @return This object for method chaining.
374
358
*/
375
- public Builder minReceiveWaitTimeMs (Duration minReceiveWaitTimeMs ) {
376
- this .minReceiveWaitTimeMs = minReceiveWaitTimeMs ;
359
+ public Builder minReceiveWaitTime (Duration minReceiveWaitTime ) {
360
+ this .minReceiveWaitTime = minReceiveWaitTime ;
377
361
return this ;
378
362
}
379
363
@@ -445,17 +429,6 @@ public Builder adaptivePrefetching(Boolean adaptivePrefetching) {
445
429
return this ;
446
430
}
447
431
448
- /**
449
- * Define the option for long polling. Specify "true" for receive requests to use long polling.
450
- *
451
- * @param longPoll The new longPoll value.
452
- * @return This object for method chaining.
453
- */
454
- public Builder longPoll (Boolean longPoll ) {
455
- this .longPoll = longPoll ;
456
- return this ;
457
- }
458
-
459
432
public BatchOverrideConfiguration build () {
460
433
return new BatchOverrideConfiguration (this );
461
434
}
0 commit comments