Reputation: 197
I have a very simple scenario. I create a queue, exchange and bind the queue to exchange.
Code :
String queueName = new StringBuilder("LP.DATA.").append("TESTACCOUNT").append(".").append("subLP").toString();
channel.exchangeDeclare(ExchangeConstants.DATA_EXCG, "direct", true);
channel.queueDeclare(queueName, true, false, false, null);
channel.exchangeBind(queueName, ExchangeConstants.DATA_EXCG, queueName);
I get the following error when exchangeBind() is called.
com.rabbitmq.client.ShutdownSignalException: channel error; reason: {#method<channel.close>(reply-code=404, reply-text=NOT_FOUND - no exchange 'LP.DATA.TESTACCOUNT.subLP' in vhost '/', class-id=40, method-id=30), null, ""}
My ExchangeConstants.DATA_EXCG is "DATA_EXCG". Using RabbitMq admin I see that the exchange and queue are all created. From the exception I don't understand why is it looking for exchange with name "LP.DATA.TESTACCOUNT.subLP", this is a queuename. It seems quite trivial, I am sure I am missing something.
I am using java rabbitmq-client version 3.04.
Upvotes: 0
Views: 1393
Reputation: 61
channel.exchangeBind(java.lang.String destination,
java.lang.String source,
java.lang.String routingKey)
this function bind 2 exchange together: destination and source are both supposed to be exchanges.
Here, you should use channel.queueBind
instead.
Upvotes: 2