Hi,<br><br>I have a simple cluster setup consisting of 2 nodes. Call them A and B going forward. <br><br>Status of node rabbit@B...<br>[{running_applications,[{rabbit,"RabbitMQ","1.7.0"},<br> {mnesia,"MNESIA CXC 138 12","4.4.7"},<br>
{os_mon,"CPO CXC 138 46","2.1.8"},<br> {sasl,"SASL CXC 138 11","2.1.5.4"},<br> {stdlib,"ERTS CXC 138 10","1.15.5"},<br>
{kernel,"ERTS CXC 138 10","2.12.5"}]},<br> {nodes,[rabbit@A,rabbit@B]},<br> {running_nodes,[rabbit@A,rabbit@B]}]<br>...done.<br><br>I have a simple consumer that connect to B and a simple producer that connects to B and produces messages. This is working fine and I connect to the cluster via the newConnection method that takes an array of Addresses.<br>
<br>ConnectionParameters params = new ConnectionParameters();<br>params.setUsername("guest");<br>params.setPassword("guest");<br>params.setVirtualHost("/");<br>params.setRequestedHeartbeat(0);<br>
<br>ConnectionFactory factory = new ConnectionFactory(params);<br> Address[] addresses = {new Address("192.168.44.1", 5672), <br> new Address("192.168.44.129", 5672)};<br><br>Connection conn = factory.newConnection(addresses, 1);<br>
Channel channel = conn.createChannel();<br><br>...<br><br>The problem comes if I stop node B via the stop_app command <br><br>$ sudo rabbitmqctl stop_app<br>Stopping node rabbit@B ...<br>...done.<br><br>$ sudo rabbitmqctl status<br>
<br>Status of node rabbit@B ...<br>[{running_applications,[{sasl,"SASL CXC 138 11","2.1.6"},<br> {stdlib,"ERTS CXC 138 10","1.16.2"},<br> {kernel,"ERTS CXC 138 10","2.13.2"}]},<br>
{nodes,[rabbit@B,rabbit@A]},<br> {running_nodes,[rabbit@A]}]<br>...done.<br><br>and start my consumer again I get the following exception<br><br>Exception in thread "main" java.io.IOException<br> at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:121)<br>
at com.rabbitmq.client.impl.ChannelN.basicConsume(ChannelN.java:618)<br> at com.rabbitmq.client.impl.ChannelN.basicConsume(ChannelN.java:582)<br> at com.rabbitmq.client.impl.ChannelN.basicConsume(ChannelN.java:574)<br>
at RabbitMQConsumer.main(RabbitMQConsumer.java:38)<br> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br>
at java.lang.reflect.Method.invoke(Method.java:597)<br> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)<br>Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; reason: {#method<channel.close>(reply-code=404,reply-text=NOT_FOUND - no queue 'myQueue' in vhost '/',class-id=60,method-id=20),null,""}<br>
at com.rabbitmq.client.impl.ChannelN.processAsync(ChannelN.java:191)<br> at com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:159)<br> at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:110)<br>
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:449)<br><br>Can anyone shed some light on what I am doing wrong? I thought that the queue would be re-created since I am using the declare statement. Snippet from consumer<br>
<br>channel.exchangeDeclare(exchangeName, "direct", durable);<br>channel.queueDeclare(queueName, durable);<br>channel.queueBind(queueName, exchangeName, routingKey);<br><br><br>I have attached the consumer and producer code. <br>
<br>thanks!<br><br>dave<br>