nest icon indicating copy to clipboard operation
nest copied to clipboard

Wildcard support for Redis subscriptions in microservices

Open tijsmoree opened this issue 3 years ago • 1 comments
trafficstars

Is there an existing issue that is already proposing this?

  • [X] I have searched the existing issues

Is your feature request related to a problem? Please describe it

When creating a Redis microservice, it is not possible to make use of wildcards in the pattern/topic (like it is for MQTT for example). This however is supported by the npm packages 'redis' and 'ioredis' by using psubscribe instead of the simpler subscribe.

(Another issue with the same request (#5211) was closed, but I do believe it to be a good feature.)

Describe the solution you'd like

Start using psubscribe instead of subscribe in the source code of the Redis microservice. This makes sure it is possible to use wildcards in the pattern/topic.

I cannot think of any drawbacks, because it simply is an extra feature and the documentation of Redis itself specifies that there is no speed difference. The time complexity of either function is the same.

Teachability, documentation, adoption, migration strategy

The docs of the MQTT microservice already include an extra section for the wildcards explicitly. A similar one could be included for the Redis page, where the specifics on the wildcards would have to be changed. The reader could also be redirected to the Redis website for those details (https://redis.io/commands/psubscribe/).

What is the motivation / use case for changing the behavior?

I think it is a nice feature to make the Redis microservice more complete and useful and I cannot think of any drawbacks.

tijsmoree avatar Oct 03 '22 15:10 tijsmoree

Would you like to create a PR for this issue?

kamilmysliwiec avatar Oct 04 '22 06:10 kamilmysliwiec

Let's track this here https://github.com/nestjs/nest/pull/10359

kamilmysliwiec avatar Feb 01 '23 12:02 kamilmysliwiec