onebeyond / rascal

A config driven wrapper for amqp.node supporting multi-host connections, automatic error recovery, redelivery flood protection, transparent encryption / decryption and channel pooling.
MIT License
451 stars 69 forks source link

Force shared exchanges and queues to override namespace #152

Closed Derwaan closed 3 years ago

Derwaan commented 3 years ago

Hi there,

I would like to declare a namespace for my application so that every queue and exchange that my application declares is prefixed with the corresponding namespace. For this, I am using the namespace configuration and everything works fine.

But I would also like to declare shared queues or exchanges that should not be prefixed with the namespace as they are created by another application.

How can I solve this?

Thanks for your time!

cressie176 commented 3 years ago

Hi Derwaan,

This wasn't the intended purpose of namespaces - they were designed so applications could be tested in isolation against the same RabbitMQ broker. If I understand correctly you want to enforce a specific queue/exchange format.

There are two approaches I think you could take to achieve this...

  1. Generate, pre-process or validate the config before passing it to rascal
  2. Define two vhosts with the same connection details.

I would go for (1), as the latter would lead to a fair amount of duplication. It may have other side effects which I can't think of right now too.

Derwaan commented 3 years ago

Thanks for your feedback! I will go with solution (1) and generate my configuration.