Repository navigation
Message routed to two queues when it matches multiple Publish rules (base class + interface) #2463
Unanswered
ali-pouneh
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
When a message type inherits from a base class AND implements an interface, and there are
separate
Publishrules for each, Wolverine sends the message to both queues. I needmutually exclusive routing: deduplicated messages should go ONLY to their deduplication queue,
and non-deduplicated messages should go to the default queue.
Setup
I have a hierarchy of events all deriving from
AppEvent, and a set of marker interfacesfor Azure Service Bus duplicate detection with different time windows:
A concrete event implements both:
My routing configuration registers a publish rule per deduplication window, plus a catch-all
for
AppEvent:Each deduplication queue has
RequiresDuplicateDetection = trueon the ASB side withan appropriate
DuplicateDetectionHistoryTimeWindow.Problem
When I publish an
OrderUpdatedEvent, Wolverine matches two rules:IMediumDeduplicationWindow→ routes toapp-queue-dedup-mediumAppEvent→ routes toapp-queueSo the message is delivered to both queues. The consumer processes it twice.
Desired behavior
IDeduplicatableinterface → send only tothe matching deduplication queue
AppEvent(no deduplication interface) → send to thedefault
app-queueWhat I've tried / considered
AppEventlast) — doesn'thelp, Wolverine evaluates all matching rules.
IMessageRoutingConvention— seems like the right approach but I'mnot sure how to properly implement exclusive routing with it.
Question
Is there a built-in way to make publish rules exclusive / first-match-wins? Or is the
recommended approach to use a custom
IMessageRoutingConventionthat inspects the messagetype and returns only one endpoint? If so, could someone point me to an example?
Any guidance appreciated. Thanks!
All reactions