Files
floci/src/main/java
Kurt McAlpine ad0f4a1613 fix(sqs): honour ReceiveMessageWaitTimeSeconds when ReceiveMessage omits WaitTimeSeconds (#2989)
* fix(sqs): honour ReceiveMessageWaitTimeSeconds when ReceiveMessage omits WaitTimeSeconds

ReceiveMessage treated a missing WaitTimeSeconds as 0 and returned
immediately, ignoring the queue's ReceiveMessageWaitTimeSeconds
attribute. AWS applies that attribute as the default wait, and only an
explicit WaitTimeSeconds in the request overrides it, so consumers that
enable long polling on the queue were short polling against Floci.

Both protocol handlers now pass -1 when the parameter is absent, and the
service resolves the wait from the queue attribute, mirroring the
existing VisibilityTimeout fallback. CreateQueue stores the AWS default
of 0 so GetQueueAttributes reports the attribute like AWS does.

* fix(sqs): reject ReceiveMessage WaitTimeSeconds outside 0 to 20

An explicit negative or non-integer WaitTimeSeconds was parsed to the
"omitted" sentinel and inherited the queue's long poll instead of
failing. Carry the parameter as a nullable Integer, reject malformed
values at the protocol boundary and out-of-range values in the service
with InvalidParameterValue, and cap the queue attribute fallback at the
AWS maximum of 20 seconds.

* fix(sqs): reject fractional WaitTimeSeconds on the SQS JSON protocol

canConvertToInt() accepts fractional JSON numbers such as 1.5, which
asInt() then truncated before the range check, so a malformed request
ran as a one second poll instead of failing with InvalidParameterValue.

Signed-off-by: Kurt McAlpine <kurt.mcalpine@halter.co.nz>

---------

Signed-off-by: Kurt McAlpine <kurt.mcalpine@halter.co.nz>
2026-09-03 11:29:36 -04:00
..