I'm attempting to write up a channel pattern for a Redis subscription such that, when my application is in Debug mode, I subscribe to all channels ending in _dev, but when not in debug mode, I subscribe to all channels that specifically don't end in _dev. My channels look something like: CommandChannel_<id> or CommandChannel_<id>_dev
I understand that, according to the documentation, "all glob-style patterns are valid", and so I've written up a pattern that I feel like should do the trick:
string subBase = "CommandChannel_"
redisSubscription.SubscribeAsync(subBase + "*" + (DEBUG ? "_dev": "!(_dev)"), async (channel, message) =>
{
// Do stuff
}
What I'm finding is that, when in DEBUG mode, my subscription works fine - I correctly "catch" all messages over any channel matching the pattern of CommandChannel_<id>_dev. But when I change the application to not be in DEBUG mode, my subscription doesn't catch anything despite definitely publishing to appropriate channels (CommandChannel_<id>). As I understand it, !(_dev) should exclude any channels ending in _dev, but allow all other channels that I expect.
What am I missing here?