SzymonPobiega / NServiceBus.Router

Cross-transport, cross-site and possibly cross-cloud router component for NServiceBus
MIT License
5 stars 10 forks source link

Messages without MessageIntent are consumed and dropped #22

Closed slahn closed 4 years ago

slahn commented 4 years ago

Hi, I'm using the router to route some non-nservicebus messages into our nservicebus system. It works fine, after I discovered the problem. Thanks for the great work.

As the title says, messages that are missing intent are dropped silently.

I handled this in our system with a custom rule that throws UnforwardableMessageException, but I think this rule should be in the default router, so that messages are moved to the poison queue instead of being dropped.

Happy to do a PR with my (simple) rule.

slahn commented 4 years ago

Actually, now that I think more about it, shouldn't the TerminatorInvocationRule throw if no terminators are invoked? That would catch the problem of unhandled messages in a more general way than a rule looking specifically for this single issue.

SzymonPobiega commented 4 years ago

Hey

Thanks for reporting this. I've fixed it (but not yet released) by adding explicit flags to indicate the fact that a message has been deemed OK for dropping. If that flag is not set and the message is not handled (e.g. when it does not have the intent header), the UnforwardableMessageException moves it to the poison queue.