You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Standard SQS queues with a DelaySeconds attribute were not applying the delay to messages sent without an explicit per-message DelaySeconds
Root cause: the handler→service API used primitive int (default 0), making it impossible to distinguish "omitted" from "explicit 0"
Changed int delaySeconds to Integer delaySeconds across the handler/service chain so null falls back to the queue attribute while Integer(0) overrides it
Added tests for both queue-level delay application and explicit zero override
Test plan
mvn verify passes all tests including new standard queue delay tests
Existing FIFO delay tests still pass
Camel Spring Boot SqsDelayedQueueTest passes with the fixed floci image
Nice fix, Federico, and it lines up exactly with how AWS models this. DelaySeconds is a NullableInteger on both SendMessage and the batch entry precisely so the service can tell an omitted value from an explicit 0, so moving from int to Integer is the right root cause fix. The null to queue default, explicit 0 to override behavior matches the docs ("if you don't specify a value, the default value for the queue applies"), and I like that the tests cover both directions and you dropped the stale follow-up comment.
One small thing: in the query handler getIntegerParam swallows a parse error and returns null, so a malformed DelaySeconds like "abc" gets treated as omitted and quietly picks up the queue default, whereas AWS returns a validation error for a non-integer value. Low impact since clients send valid integers, just noting it.
This PR fixes standard SQS queues not honoring the queue-level DelaySeconds attribute when messages are sent without an explicit per-message delay. The root cause was that int delaySeconds defaulted to 0, making it impossible to distinguish "omitted" (fall back to queue attribute) from "explicitly 0" (override).
SqsService.java: Replaces the ternary queue.isFifo() ? queueDelaySeconds : delaySeconds with a proper null-aware branch — standard queues now fall back to queueDelaySeconds when delaySeconds is null.
SqsJsonHandler.java / SqsQueryHandler.java: Each handler adds a new parsing helper (parseOptionalInteger / getIntegerParam) that returns null for a missing parameter and throws AwsException for a non-integer value, aligning validation symmetrically across both protocol paths.
SqsServiceTest.java: Two new unit tests cover queue-level delay application and explicit-zero override for standard queues.
Confidence Score: 5/5
Safe to merge — the change is narrow, both protocol paths are updated symmetrically, and the new null-aware logic is covered by unit tests.
The int → Integer change threads through all four sendMessage overloads and both handler layers without altering existing behavior. FIFO behavior is unchanged. The new parsing helpers are symmetric across both protocol paths and both throw on non-integer input. Two unit tests confirm the queue-level fallback and explicit-zero override. No wire-format, config, or storage changes.
Core fix: int delaySeconds → Integer delaySeconds across all four sendMessage overloads; null-aware delay resolution added for standard queues while preserving existing FIFO override behavior.
Adds parseOptionalInteger helper with isIntegralNumber() guard; both SendMessage and SendMessageBatch paths now return null for absent DelaySeconds and reject non-integer values with AwsException.
Two new tests: queueLevelDelaySecondsAppliesToStandardQueue (time-based, 1-second queue delay) and explicitZeroDelayOverridesQueueDefault (immediate receipt after explicit 0 override).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DelaySecondsattribute were not applying the delay to messages sent without an explicit per-messageDelaySecondsint(default 0), making it impossible to distinguish "omitted" from "explicit 0"int delaySecondstoInteger delaySecondsacross the handler/service chain sonullfalls back to the queue attribute whileInteger(0)overrides itTest plan
mvn verifypasses all tests including new standard queue delay testsSqsDelayedQueueTestpasses with the fixed floci image