To extend the answer to @Tien Nguyen, RabbitMQ has a cheat that effectively allows publishing directly to the queue. Each queue is automatically tied to the default exchange AMQP, with the queue name as a routing key. The default exchange is also known as the "nameless exchange", that is, its name is an empty string. Therefore, if you publish in exchange with the name "" with a routing key equal to your queue name, the message is sent only to this queue. It goes through an exchange, as Johnson said, it's just not the one you need to declare or link.
I do not have a Java client that can try this code, but it should work.
channel.basicPublish("", myQueueName, false, false, null, myMessageAsBytes);
However, this is largely contrary to the spirit of how RabbitMQ works. For a normal flow of applications, you must declare and link exchanges. But in exceptional cases, a cheat may be useful. For example, I believe that Rabbit Admin Console allows you to manually publish messages in a queue without any ceremony of creating and linking exchanges.
source share