4

Can I publish messages to several channels within the same command using the glob-style pattern, such as Connection.GetSubscriber().Publish("room/*", "my message") and the message gets published to all channels that match the pattern?

Maybe the above question makes little to no sense in case I misunderstand the basic pub/sub pattern in Redis. My understanding is that each Subscribe command establishes a channel on the Redis server and hence the channels Ids are known to the server and hence when the server receives a publish command that it should have the ability to "fan out" published messages to all channels that match the glob-style pattern. Please correct if I am wrong.

Additional question, I assume I can also subscribe to multiple channels using the glob-style pattern, correct?

Thanks

CodesInChaos
  • 106,488
  • 23
  • 218
  • 262
Matt
  • 7,004
  • 11
  • 71
  • 117
  • As answrd multiple publish is not supported. But we could create custom publish cmd via lua script and run using EVAL cmd. I hv nt tested this but wrth a try. Also note the cmd wuld be atomic in nature ensuring publish to all channels via script. – Nik Apr 26 '14 at 19:41

1 Answers1

11

You can subscribe to pattern-based channel subscriptions, but when you publish you are publishing to a single channel name. All matching subscriptions (whether specific or pattern-based) will receive the message. There is no "fan out", other than the glob-based subscriptions.

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
  • This kinda sucks. I jumped on Redis because RabbitMQ was too heavy and painful to configure plus setup. So now I have add a loop :/ – TheRealChx101 Nov 08 '19 at 16:43