2

I need to receive messages of a queue, but this queue is inside in another machine(AWS instance) with https(https://www.mymachine.com/rabbitmq) but when I want to establish a connection to the queue I get a NullPointerException.

This is a part of code:

factory.setHost(https://www.mymachine.com/rabbitmq);
Connection connection = factory.newConnection();
        channel = connection.createChannel();
        channel.exchangeDeclare(EXCHANGE_NAME, "fanout");
        queueName = channel.queueDeclare().getQueue();
        channel.queueBind(queueName, EXCHANGE_NAME, "");
Miguel
  • 909
  • 2
  • 8
  • 10

1 Answers1

1

RabbitMQ, by default, does not use HTTP protocol, it uses AMQP protocol.

you have to change the factory.setHost with the ip or hostname.

factory.setHost(yourmachine)

if you need an SSL connection please read: https://www.rabbitmq.com/ssl.html it is very clear tutorial.

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