This repository has been archived by the owner on Sep 17, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use SubscriptionId to dispatch messages to handlers internally, fixes …
…#47 (#48) * Add test demonstrating receiving messages meant for other subs #47 * Only dispatch messages intended for our subscription #47 Use SubscriptionId to dispatch messages to handlers internally, rather than matching on the subject. If multiple subscriptions existed that had overlapping subjects, either through wildcards or explicit matches, then each message received for each subscription would get dispatched to every subscription (N^2). Given: - sidA = Sub("a.b", OnX) - sidB = Sub("a.*", OnY) - Pub("a.b", ...) MyNatsClient would receive: - sidA a.b <payload> - sidB a.b <payload> And dispatch: - OnX(sidA, a.b, payload) - OnY(sidA, a.b, payload) - OnX(sidB, a.b, payload) - OnY(sidB, a.b, payload)
- Loading branch information