-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Scoped Filters execute after topology conventions are applied when publishing/sending #5151
Comments
It isn't working now because the RoutingKeyFormatter is executing before your scoped filter. The routing key formatter runs first because it is specified at a lower type level than the message type for the scoped filter, at least that's my suspicion. Previously it was a race condition based upon recursively resolving a message's parent types. |
Why you wouldn't just do the work in the routing key formatter instead: configurator.Send<TEvent>(x =>
{
x.UseRoutingKeyFormatter(context =>
{
var durableEventName = (context.Message.GetType().GetProperty(DurableEventNameProperty)?.GetValue(context.Message))
?? throw new InvalidOperationException($"Message does not have the required property: {DurableEventNameProperty}" +
$" Make sure to implement {nameof(IDurableEventName)}");
return (string)durableEventName;
});
}); |
I see, moving the work in the routing key formatter indeed fixes it in my repro case. I'll make the needed changes into our applications next week and will run regression tests, will keep you informed. Thanks for the help! |
Contact Details
[email protected]
Version
8.x
On which operating system(s) are you experiencing the issue?
Linux
Using which broker(s) did you encounter the issue?
RabbitMQ
What are the steps required to reproduce the issue?
Setup an application that publishes messages to a RabbitMq topic and a consumer that reads messages from that topic. In v8.2.0 it works fine but starting v8.2.1, the consumer is no longer picking up messages (the publish seems to work fine). I created a github repo with a .NET application that reproduces this issue. The app is configured with v8.2.0 which works without problems. If you update the MassTransit packages to v8.2.1 or 8.2.2, then the consumer no longer works.
What is the expected behavior?
I'd expect the MassTransit package to have the same behavior as v8.2.0 in the later patch releases, since it shouldn't introduce breaking changes in a patch version.
What actually happened?
Bumping our MassTransit packages to the latest patch version broke our consumers
Related log output, including any exceptions
No response
Link to repository that demonstrates/reproduces the issue
https://github.com/flannoo/masstransit-consumer-issue
The text was updated successfully, but these errors were encountered: