[rabbitmq-discuss] Problem with Clustering

David Sinclair dsinclair at chariotsolutions.com
Wed Jan 6 20:53:45 GMT 2010


Hi,

I have a simple cluster setup consisting of 2 nodes. Call them A and B going
forward.

Status of node rabbit at B...
[{running_applications,[{rabbit,"RabbitMQ","1.7.0"},
                        {mnesia,"MNESIA  CXC 138 12","4.4.7"},
                        {os_mon,"CPO  CXC 138 46","2.1.8"},
                        {sasl,"SASL  CXC 138 11","2.1.5.4"},
                        {stdlib,"ERTS  CXC 138 10","1.15.5"},
                        {kernel,"ERTS  CXC 138 10","2.12.5"}]},
 {nodes,[rabbit at A,rabbit at B]},
 {running_nodes,[rabbit at A,rabbit at B]}]
...done.

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.

ConnectionParameters params = new ConnectionParameters();
params.setUsername("guest");
params.setPassword("guest");
params.setVirtualHost("/");
params.setRequestedHeartbeat(0);

ConnectionFactory factory = new ConnectionFactory(params);
 Address[] addresses = {new Address("192.168.44.1", 5672),
                new Address("192.168.44.129", 5672)};

Connection conn = factory.newConnection(addresses, 1);
Channel channel = conn.createChannel();

...

The problem comes if I stop node B via the stop_app command

$ sudo rabbitmqctl stop_app
Stopping node rabbit at B ...
...done.

$ sudo rabbitmqctl status

Status of node rabbit at B ...
[{running_applications,[{sasl,"SASL  CXC 138 11","2.1.6"},
                        {stdlib,"ERTS  CXC 138 10","1.16.2"},
                        {kernel,"ERTS  CXC 138 10","2.13.2"}]},
 {nodes,[rabbit at B,rabbit at A]},
 {running_nodes,[rabbit at A]}]
...done.

and start my consumer again I get the following exception

Exception in thread "main" java.io.IOException
    at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:121)
    at com.rabbitmq.client.impl.ChannelN.basicConsume(ChannelN.java:618)
    at com.rabbitmq.client.impl.ChannelN.basicConsume(ChannelN.java:582)
    at com.rabbitmq.client.impl.ChannelN.basicConsume(ChannelN.java:574)
    at RabbitMQConsumer.main(RabbitMQConsumer.java:38)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
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,""}
    at com.rabbitmq.client.impl.ChannelN.processAsync(ChannelN.java:191)
    at
com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:159)
    at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:110)
    at
com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:449)

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

channel.exchangeDeclare(exchangeName, "direct", durable);
channel.queueDeclare(queueName, durable);
channel.queueBind(queueName, exchangeName, routingKey);


I have attached the consumer and producer code.

thanks!

dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20100106/7d3a047f/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RabbitMQConsumer.java
Type: application/octet-stream
Size: 1854 bytes
Desc: not available
Url : http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20100106/7d3a047f/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RabbitMQProducer.java
Type: application/octet-stream
Size: 2873 bytes
Desc: not available
Url : http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20100106/7d3a047f/attachment-0001.obj 


More information about the rabbitmq-discuss mailing list