Use same Redis server for different applications with same class names

I am using Redis Message Queue
We have one class associated to one queue. This is great, but I would like to use the SAME Redis Server for different configurations Production or Development to save on hosting

I can always change the class names and use conditional compilation like the attached screenshots, but it is not great
Another option would be to modify the code accessing the queues
Would someone have an idea? Like changing the name of the queue adding something else to the name of the class

Iā€™d recommend partitioning by using a different Redis Database, e.g:

//Prod:
container.Register<IRedisClientsManager>(c => 
    new RedisManagerPool("localhost:6379?db=0"));

//Dev:
container.Register<IRedisClientsManager>(c => 
    new RedisManagerPool("localhost:6379?db=1"));

Trying to use conditional comments or mess with queue names is messy and fragile.

Thank you very much. It is working.

1 Like