0

I have a RabbitMQ implemented queue on cloud and I have written a Node.JS receiver and sender that basically will send and receive message from queue. I basically hit the uri of my queue and create a connection.

My question is : As my receiver is behind the firewall and not on any public IP, How queue sends the message to my queue? What technique it uses to publish messages to my queue? Is my receiver continuously polling the queue?

Ashish
  • 3,572
  • 3
  • 18
  • 25

1 Answers1

0

As i haven't found any answer to this question, this is my observation as per RabbitMQ documentation.

In most of the applications, when queue is not outside the system and can be accessed, implementing observer pattern is the right idea.

In my case, when queue is outside the system(on cloud) then receiver code polls the queue for any message, following sample code from RabbitMQ site confirms that.

while (true) {
    QueueingConsumer.Delivery delivery = consumer.nextDelivery();
    String message = new String(delivery.getBody());

    System.out.println(" [x] Received '" + message + "'");
}

There might be some other implementations of same logic as well..

nhahtdh
  • 55,989
  • 15
  • 126
  • 162
Ashish
  • 3,572
  • 3
  • 18
  • 25