I'm trying connect from a amqp client to a aqtivemq server with default settings. It always gives the error message saying connection refused. Then I tried it with a rabbitmq server instead of a activemq server and it works fine. I wonder whether activemq needs a linux library to communicate.
Activemq server versions used which does not connects: 5.4.2 / 5.10.0 Rabitmq version used: 3.3.5
rabitmq sample client code
import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.Channel;
public class Cache {
private final static String QUEUE_NAME = "hello";
public static void main(String[] argv)
throws java.io.IOException {
//creating the connection factory
ConnectionFactory factory = new ConnectionFactory();
factory.setHost("localhost");
//Creating a connection to the server
Connection connection = factory.newConnection();
Channel channel = connection.createChannel();
//declaring a queuw
channel.queueDeclare(QUEUE_NAME, false, false, false, null);
String message = "Hello World!";
//publishing the queue the queue
channel.basicPublish("", QUEUE_NAME, null, message.getBytes());
System.out.println(" [x] Sent '" + message + "'");
//closing the connection
channel.close();
connection.close();
}
}
Fails in the following line of code
//Creating a connection to the server
Connection connection = factory.newConnection();
How can I solve this issue ?