***Hi,all
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...