I have a Topic Exchange on my RabbitMQ. An error by sending a message.
EXCHANGE_NAME = "EX_TEST";
Receive Section:
ConnectionFactory connectionFactory = new ConnectionFactory();
connectionFactory.setHost(mServer);
mConnection = connectionFactory.newConnection();
mModel = mConnection.createChannel();
mModel.exchangeDeclare(EXCHANGE_NAME, MyExchangeType, true);
mQueue = mModel.queueDeclare().getQueue();
MySubscription = new QueueingConsumer(mModel);
mModel.queueBind(mQueue, EXCHANGE_NAME, routingKey);
mModel.basicConsume(mQueue, true, MySubscription);
Send Section:
ConnectionFactory factory = new ConnectionFactory();
factory.setHost("localhost");
Connection connection = factory.newConnection();
Channel channel = connection.createChannel();
channel.exchangeDeclare(EXCHANGE_NAME, "topic");
error on line: channel.exchangeDeclare(EXCHANGE_NAME, "topic");
Exceptions:
cannot redeclare exchange 'EX_TEST' in vhost '/' with different type, durable, internal or autodelete value, class-id=40, method-id=10
How to resolve this? thankyou :D