user2957954
user2957954

Reputation: 1249

Rabbitmq refuses connection when I set default port

I implement it in java and want to have a constructor for an end point:

public EndPoint(final String endPointName, final String host, final int port){
    this.name=endPointName;
    ConnectionFactory factory = new ConnectionFactory();

    factory.setHost(host);
    factory.setPort(port);
    connection = factory.newConnection();

    channel = connection.createChannel();
    channel.queueDeclare(name, false, false, false, null);  

}   

And I receive EOFException:connection refused even when I set the arguments "localhost" and 15672 which are considered to be default as far as I understand. The problem is with the method setPort(): without it everything works perfectly.

Why do I think that 15672 port is correct? Without setPort() I can open my browser Rabbitmq helper at localhost:15672 and see my created queues.

How can I set the port without an exception?

Upvotes: 0

Views: 1967

Answers (2)

M.A. Hanin
M.A. Hanin

Reputation: 8074

The default port of RabbitMQ's operational protocol is 5672; port 15672 is the default port for the management plugin (the "GUI").

Upvotes: 3

Kevin Boone
Kevin Boone

Reputation: 4307

Different releases of RabbitMQ have different default ports. If the code works without the setPort() call, then I expect that the default the RabbitMQ client runtime library uses -- whatever that is -- is correct, and your specific choice of 15672 is not correct.

"connection refused" nearly always means that nothing is actually listening on the specified port.

Upvotes: 0

Related Questions