Open StKolev opened 2 months ago
serialization on the consumers has no effect on filtering. in your example you are creating one consumer and three consume tasks using NextAsync<T>()
methods. they would pick up the next message available to that one consumer regardless of the generic type being used in the Next
call. so essentially serialization is a pre-agreed notion and has no effect on filtering or message routing.
Observed behavior
When a single consumer is configured over multiple filter subjects using
FilterSubjects
configuration option, the messages are mixed up and wrong messages are delivered when received from nats-server. I have created a single console app that reproduce this problem. In my use case I have batch of orders. First I publishBatchCreatedEvent
, then each order that is part of the batch and thenBatchCompleted
event.When
BatchCreatedEvent
is about to be consumed, it receives message payload withOrderCreatedEvent
. WhenOrderCreatedEvent
is about to be consumed, it receives message payload with eitherBatchCreatedEvent
orBatchCompletedEvent
.Logging produced:
Expected behavior
When I configure consumer to receive messages from multiple subjects, I expect messages to be routed to right "handlers" given the message subject.
Server and client version
Server version: 2.10.18 Client version: 2.3.3
Host environment
No response
Steps to reproduce
https://github.com/StKolev/Nats.ConsumerRoutingTest