Closed mgravell closed 1 year ago
You marked string initialization of RedisChannel as Obsolete, but there is no any doumentation how to use new RedisChannel functions.
The obsolete message literally gives that guidance, but yes we should check for any existing docs and update
The obsolete message literally gives that guidance, but yes we should check for any existing docs and update
A guidance? It raises questions only. Warning CS0618 'RedisChannel.implicit operator RedisChannel(string)' is obsolete: 'It is preferable to explicitly specify a PatternMode, or use the Literal/Pattern methods'
What is PatternMode and Literal/Pattern methods?
I will revise the message, and improve the docs, but to give you an answer today: RwdisChannel.Literal
/ RedisChannel.Pattern
, or the RedisChannel
constructor that takes a PatternMode
ok, understood now, so instead of providing string key for subscribe, we need to use RedisChannel.Literal(key) or RedisChannel.Pattern(keysPattern) if using patterns
You can still use a string if you eat the CS0618 - and if you want to use the old behaviour without the warning, the constructor (explicitly stating .Auto
as the enum) achieves that. It is ambiguous though, and might not be advisable in all scenarios. The design is regretted, and we would prefer to make people ask themselves "am I subscribing to a single literal channel, or to a pattern of channels?"
Just getting around to a package update. This obsolete message still completely lacks context, and all I've been able to find is this PR, which is also absent intent of the change.
I'll try to improve that. Short version:
@mgravell that makes sense, thank you. I think the missing context was that, until this, I wasn't aware that wildcards were possible in the pub/sub, so that's something new to me. I can't think of any situations where I would want to do that, but I suppose someone else could.
Right; so use RedisChannel.Literal - job done
One part of the missing doc update is the redis backplane docs which use the obsolete string method.
https://learn.microsoft.com/en-us/aspnet/core/signalr/redis-backplane?view=aspnetcore-8.0
I can take that, thanks
fixes #2479 (option 1)