2026-08-11

Had to do some changes to NATS streams and consumers today, and learnt a few things from doing so.

First, it is possible to change the subject filters of a NATS consumer while it’s being used. That is, a client could be using it to pull messages, and it doesn’t need to reconnect or anything to get the effect of the consumer change. It will continue to receive messages, so long as they match the new subject filter.

Second, if you’re using the NATS CLI to change the filter, in order to specify multiple subject filters, include multiple --filter switches:

$ dc-nats consumer edit \
        --filter='topic.one' \
        --filter='topic.two' \
        --filter='topic.reset.>' my-stream my-consumer

Specifying a single --filter value with subjects separated by commas will not work. I’m not entirely sure what will happen but I suspect that it will create a subject filter that includes the commas in some way.