mardi 27 juillet 2021

Is it always bad to use default exchange in RabbitMQ?

I've already used RabbitMQ a lot in my work, and sometimes I use the default exchange in some scenarios. For example, I need to post a time-consuming render job to one specific render queue, and some background worker programs will consume it. It was like this:

default exchange => VideoRenderQueue
default exchange => ModelRenderQueue

The confusion I have here is people considering using default exchange as an anti-pattern in the case of software design, as it creates coupling between publisher and consumer. So instead of using the default exchange, I started to declare a new direct exchange every time I have a new type of rendering queue and bind the rendering queue to it (see below). But soon I doubted that if this approach is no different from using the default exchange.

videoRenderExchange => VideoRenderQueue
modelRenderExchange => ModelRenderQueue

So what is the best practice should I follow in this scenario? Or is there something that I missed here?

Aucun commentaire:

Enregistrer un commentaire