Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Messages that have exhausted the retry count are being given an invalid delay value when passed to SQS #18

Closed
ajacksms opened this issue Feb 20, 2018 · 1 comment

Comments

@ajacksms
Copy link
Contributor

We have an implementation of IHandleMessages<IFailed<>> which throws an exception when the maximum retry count has been met, so that Rebus will place it in the dead letter queue. We have enabled the UseNativeDeferredMessages option.

Rebus does this, however, the value of DelaySeconds passed to SQS is a negative integer, which is invalid and SQS throws an exception. When we are iterating through our retries, we are using Defer, which updates the rbs2-deferred-until header value with a new time when the message should be retried. On the final attempt, this value is not updated.

I am of the opinion that when the GetDelaySeconds method in AmazonSqsTransport.cs is called with a DeferredUntil value in the header that is before the current time, then GetDelaySeconds should return zero, as that message should be processed without delay.

Detail of the error message thrown from the API:
Rebus.Workers.ThreadPoolBased.ThreadPoolWorker An error occurred when attempting to complete the transaction context System.AggregateException: One or more errors occurred. ---> Amazon.SQS.AmazonSQSException: Failed Value -8 for parameter DelaySeconds is invalid. Reason: DelaySeconds must be >= 0 and <= 900. with Code=InvalidParameterValue, SenderFault=True

ajacksms added a commit to ajacksms/Rebus.AmazonSQS that referenced this issue Feb 26, 2018
Issue rebus-org#18 - Messages that have exhausted the retry count are being given an invalid delay value when passed to SQS

Altered the GetDelaySeconds method so that when the deferreduntil method is in the past, the message is passed to SQS with zero delay.
Added new test to verify result.
ajacksms added a commit to ajacksms/Rebus.AmazonSQS that referenced this issue Mar 1, 2018
@ajacksms ajacksms mentioned this issue Mar 1, 2018
mookid8000 added a commit that referenced this issue Mar 2, 2018
@mookid8000
Copy link
Member

This one seems to have been solved by #19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants