[rabbitmq-discuss] basicPublish() Hangs on the Upstream Node in a Federation

Chris Judkins-Fisher squall1386 at hotmail.com
Thu Jul 26 19:59:52 BST 2012


Hello,

For some reason, I'm unable to publish messages to any exchange/queue on one of the VMs I'm using for testing RabbitMQ federations. My setup is as follows:

I have two VMs named rabbit1 and rabbit2, both with the federation plugin enabled. 
Rabbit1 is configured [1] with a federated exchange with a connection to rabbit2.

When I look at the federation status, I see that the connection is successfully established. The appropriate upstream exchange and queue are also automatically created on rabbit2. However, if I try to publish to an exchange from rabbit2, the code appears to hang and the message is never delivered. This happens whether I'm publishing to the upstream federated exchange, or just to a local exchange and queue. An example Test.java [2] runs correctly on rabbit1 or my local machine, but doesn't complete on rabbit2. It might be worth noting that the print statement _does_ execute after channel.basicPublish(...), but prints put after channel.close() or connection.close() don't occur.

I'm not sure what the next step is in troubleshooting this. Any help would be appreciated.

Thanks for taking a look.


[1] Rabbit1's rabbitmq.config

[{rabbitmq_federation,
    [
        {exchanges, [[{exchange, "high"},
            {type, "topic"},
            {upstream_set, "tomcats"}]]},
        {upstream_sets, [{"tomcats", [[{connection, "tomcat1"},
                {exchange, "highw1"},
                {max_hops, 1}]
            ]}]},
        {connections, [{"tomcat1", [{host, "out"},
                {port, 5672}]}]}
    ]
}].


[2] The code in Test.java

import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.Channel;

public class Test {

  public static void main(String[] argv) throws Exception {

    ConnectionFactory factory = new ConnectionFactory();
    factory.setHost("localhost");
    Connection connection = factory.newConnection();
    Channel channel = connection.createChannel();
    channel.exchangeDeclare("testexchange", "topic");
    channel.queueDeclare("testqueue", true, false, false, null);
    channel.queueBind("testqueue", "testexchange", "photo");

    String message = "Hello World!";
    channel.basicPublish("testexchange", "photo", null, message.getBytes());
    System.out.println(" [x] Sent '" + message + "'");

    channel.close();
    connection.close();
  }
}
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120726/0c94a49c/attachment.htm>


More information about the rabbitmq-discuss mailing list