1

I am new in using rabbitMQ and I am trying to sent an 'hello' message over internet,

I am implementing the example available in the rabbitMQ website Java RabbitMQ Hello world example, but in the example they use localhost, I try to change it to the IP address for the sender and receiver computer as explained at the website and put the sender code at a machine and receiver code on another, but it doesn't work.

My questions:
1) is rabbitMQ works over internet or it works just over local network?
2) in both cases, how to configure each computer and what each one should have?
3) Do I need to install rabbitMQ on both machines? or on one of them to run it a server?

Please if anyone can help me in configure them step-by-step, get me an answer with details.

Ryan Vincent
  • 4,483
  • 7
  • 22
  • 31
Jar
  • 11
  • 2

2 Answers2

0

It is a grant problem. The user guest guest ( default for rabbitmq ) works only in localhost.

Please read this post: Can't access RabbitMQ web management interface after fresh install

and also this:

RabbitMQ 3.3.1 can not login with guest/guest

To enable guest guest and/or create a new user.

The best practice is to create another user.

Gabriele Santomaggio
  • 21,656
  • 4
  • 52
  • 52
0

Let me answer your questions one by one

1) Yes. RabbitMQ should work over internet, you should be able to connect by giving the public ip of the RabbitMQ server. If you connecting to a server with username/password enabled then it should be provided while creating the connection.

ConnectionFactory factory = new ConnectionFactory();
factory.setUsername("username");
factory.setPassword("pwd");

2) One of the machines should have the RabbitMQ server(broker) installed and running. You can produce or consume messages from any of the machines using Java RabbitMQ client. If you had 3 machines then all three, the RabbitMQ server, message producer and message consumer could be on 3 machines.

3) You don't need to install RabbitMQ on both the machines. Install only on the machine which is running as server.

Vishal John
  • 4,231
  • 25
  • 41