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

Defer using SQL Native TimeoutManager doesn't work in v7.2.0 #98

Open
Denifia opened this issue Feb 2, 2023 · 5 comments
Open

Defer using SQL Native TimeoutManager doesn't work in v7.2.0 #98

Denifia opened this issue Feb 2, 2023 · 5 comments
Labels

Comments

@Denifia
Copy link

Denifia commented Feb 2, 2023

I have a use case where two systems are using rebus as two-way clients with sql server as the transport, each with their own queue name. System1 defers messages to System2 and in v7.1.7 that works fine but now that I've finally upgraded to v7.2.0, that functionality seems to be broken.

In System1, when a message is deferred via IBus.Defer or IBus.DeferLocal and the optional header rbs2-defer-recipient is set to "System2", a Rebus.Exceptions.MessageCouldNotBeDispatchedToAnyHandlersException is thrown when the message is dequeued from the "System1" queue and processed. To me, that sounds like it didn't attempt to deliver the message to System2 at all.

I've looked through the code and can't spot the exact issue but have been able to recreate my scenario with unit tests. Note that the ItWorks_SetDestinationHeaderFromTheOutside_WithTwoWaySender_AndSqlServerTimeoutManager test works if you set routing queue to "receiver" but that's not applicable for my situation.

I'd like to know if this is expected behaviour, if I've misconfigured something, or if it's a bug. If it's a bug I'm happy to help find and test a fix.

One additional finding I made is that in the existing tests, the automatic defer recipient pipeline step is never hit as the header is already set by something else.

@mookid8000 mookid8000 added the bug label Feb 2, 2023
@mookid8000
Copy link
Member

mookid8000 commented Feb 3, 2023

The problem seems to be that the rbs2-defer-recipient header gets overwritten by Rebus' routing:
image

That seems like an unnecessarily strict thing to do, so I'll just go and see if I can relax that a bit. brb

No that was not the case. Looking at your test again.

@mookid8000
Copy link
Member

I guess the AutoDeferredRecipientStep must have been made redundant at some point in time. Cannot quite understand how that happened, but for that reason I'll go and update the test to verify something that makes more sense.

@mookid8000
Copy link
Member

Could you maybe look at the update test https://github.com/rebus-org/Rebus.SqlServer/blob/master/Rebus.SqlServer.Tests/Bugs/TestNativeDeferToSomeoneElse.cs and see if there's any of the updated test cases that match your scenario?

@Denifia
Copy link
Author

Denifia commented Feb 4, 2023

Thanks for looking into this so quickly. I'll review your new tests against my use case when I'm back at work on Monday.

@Denifia
Copy link
Author

Denifia commented Feb 6, 2023

New tests are good but no, they don't cover my use case.

If you replace the sender's transport setup with .Transport(x => x.UseSqlServer(new SqlServerTransportOptions(ConnectionString), "sender")), all 3 of the tests fail.

I am using 2 two-way clients in my use case. In your tests, you have 1 two-way client and 1 one-way client.

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

No branches or pull requests

2 participants