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

deferCount is not increasing #33

Closed
djhvscf opened this issue Mar 22, 2021 · 2 comments
Closed

deferCount is not increasing #33

djhvscf opened this issue Mar 22, 2021 · 2 comments
Assignees
Projects

Comments

@djhvscf
Copy link

djhvscf commented Mar 22, 2021

Hi,

When we try to setup the second level retry configuration, the deferCount header increases only to 1, after that it is not increasing more.

Sometimes when it reaches the deferCount = 1, it is duplicating the messages.

Rebus.AmazonSqs: 6.2.0
.NET Framework: 4.7.1

public Task Handle(TestMessage message)
        {
            throw new Exception("whatever"); //Second level retry tests
        }

public Task Handle(IFailed<TestMessage> message)
        {
            var deferCount = Convert.ToInt32(context.Headers.GetValueOrDefault(Headers.DeferCount));
            if (deferCount >= 5)
            {
                return bus.Advanced.TransportMessage.Deadletter($"Failed after {deferCount} attempts\n\n{message.ErrorDescription}");
            }

var defer = 3 * (deferCount + 1);
            Console.WriteLine($"DEFER: {deferCount}, MINUTES: {defer}");
            return bus.Advanced.TransportMessage.Defer(TimeSpan.FromMinutes(defer));
        } 

Our workaround is use the CorrelationSequence header which is working as expected.

@mookid8000 mookid8000 self-assigned this Mar 23, 2021
@mookid8000 mookid8000 added this to Assess in Rebus via automation Mar 23, 2021
@mookid8000 mookid8000 moved this from Assess to Planned in Rebus Mar 23, 2021
@mookid8000 mookid8000 moved this from Planned to In progress in Rebus Mar 23, 2021
@mookid8000
Copy link
Member

Found out that this was a bug 😳 when using SQS's native ability to delay message delivery, it's important that Rebus REMOVES the rbs2-deferred-recipient header when sending the message – otherwise, the message would be sent to the wrong queue when dead-lettering it.

This is fixed in Rebus.AmazonSQS 6.3.1, which is on NuGet.org now.

Thanks for reporting this issue! 🙂

Rebus automation moved this from In progress to Done Mar 23, 2021
@djhvscf
Copy link
Author

djhvscf commented Mar 24, 2021

Hi @mookid8000 after testing your fix, it is still happening, deferCount is reaching 1 and then it is doing nothing different. One thing to add is that we're using this library https://github.com/raol/amazon-sqs-net-extended-client-lib

Do you think that use the CorrelationSequence is a good workaround?

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

No branches or pull requests

2 participants