T
T
topuserman2019-10-25 18:05:59
RabbitMQ
topuserman, 2019-10-25 18:05:59

RabbitMQ: exchange should be a separate file?

I am studying RabbitMQ, as I understand, all messages to the queue must come through exchange from the producer.
Exchange in turn routes the message.
In the code examples, exchange is written right in the producer's code - is that correct? Or should Exchnage be a separate file?
Those. As far as I understand, there can be several files-exchanges, and each one is configured for its own type (direct/topic/fanout/headers), and when sending a message, we send it to the desired exchange?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Shumov, 2019-10-25
@inoise

Ideally, this should be interpreted by the infrastructure configuration, of course
. Otherwise, you understand correctly

S
Sergey, 2019-10-25
@yarkin

Exchange is a server object, the client only needs to know its name (string) to send a message. The client can create new extensions, for which you need to provide more information to RabbitMQ (for example, type), in the manuals this is exactly what they use to simplify and show the entire configuration explicitly. In real production, IMHO, it is better that the entire infrastructure of exchangers and queues be pre-prepared by separate utilities, but for small services this is a big overhead and it is easier to create everything from code. I would recommend to look even in the direction of such a solution .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question