MessagePipe icon indicating copy to clipboard operation
MessagePipe copied to clipboard

Question: Behaviour for distributed publishers/subscribers

Open iangralinski-invetech opened this issue 2 years ago • 1 comments

When using IDistributedPublisher<TKey, TMessage> and IDistributedSubscriber<TKey, TMessage>, is the intended behaviour that the subscriber message handler gets invoked only based on the type of TKey, or both TKey and TMessage.

For instance, if I have TKey=int with two different message types TMessage=Message1 and TMessage=Message2, then I publish using the distributed publisher PublishAsync(1, new Message1()), is it expected that a subscriber that is only handling Message2 would receive this message?

iangralinski-invetech avatar Nov 02 '23 02:11 iangralinski-invetech

When you use the keyed pub/sub asymmetrical api you setup your subscription to listen on that key and type pairing, period. Unlike the non-keyed api the keyed api will not broadcast to a set of subscribers listen on a type; conversely, if you have more than one part of your application listen on a keyed/Type pairing and you have the prerequisite handlers setup the they will receive data on the keyed/typed pairing. If you have a different keyed/type pairing you'll need a specific handler for it.

TaviTruman avatar Nov 22 '23 00:11 TaviTruman

Thanks TaviTruman for your explanation.

hadashiA avatar Mar 29 '24 03:03 hadashiA