[rabbitmq-discuss] Hi, all.How to get messages from the rabbitmq server which is installed in another machine?

yby538 yby538 at 163.com
Thu Aug 22 14:03:16 BST 2013


Hi,all

I am a rabbitmq user from China and i am sorry that my English is very poor...

I have two machines.One is real and the other one is installed by Vmware Workstation.They connect via NAT
The real one(host machine) was set to: IP:192.168.241.1 Subnetmask:255.255.255.0 gateway IP:192.168.241.2
and the virtual machine was set to: IP:192.168.241.11 Subnetmask:255.255.255.0 gateway IP:192.168.241.2
and I have installed rabbitmq both in host machine and viratual machine.I run this code in my host machine:
ConnectionFactory factorySTC = new ConnectionFactory();
factorySTC.setHost("localhost");
factorySTC.setPort(5672);
Connection connectionSTC = factorySTC.newConnection();
Channel channelSTC = connectionSTC.createChannel();
channelSTC.queueDeclare("queue", true, false, false, null);
String message="helloworld";       
channelSTC.basicPublish("","queue",
MessageProperties.PERSISTENT_TEXT_PLAIN,message.getBytes());
I mean,i want to send "hellworld" to queue "queue"
and I run this code in my host machine(whose ip was set to 192.168.241.11 above):
ConnectionFactory factorySTC = new ConnectionFactory();
factorySTC.setHost("192.168.241.1");
factorySTC.setPort(5672);
Connection connectionSTC = factorySTC.newConnection();
Channel channelSTC = connectionSTC.createChannel();
channelSTC.queueDeclare("queue", true, false, false, null);
QueueingConsumer cosumerSTC=new QueueingConsumer(channelSTC);
QueueingConsumer.Delivery delivery = cosumerSTC.nextDelivery();
String message = new String(delivery.getBody());
but it does not work.It failed and something shows that"connect timed out...."
so,how to solve this problem?I mean,i want to get message from the rabbitmq queues which are installed in machines which are in the same LAN with my pc...
thanks very very very much in advance...
Regards...

2013-08-22



yby538
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130822/6622e9dc/attachment.htm>


More information about the rabbitmq-discuss mailing list