0
votes

The goal is to publish/send message into ActiveMQ through Java code inside a secured company network.

I have configured ActiveMQ in an AWS Cloud EC2 machine (console access: IPAddress:8161). Also I can publish the messages using the AWS IPAddress and port number 61616 (IPAddress:61616) through Java code.

But now I need to publish messages from inside a company network. It is secured and can't access the AWS IPAddress directly.

So we create reverse proxy for

IPAddress:8161 to activemq-ui.testdemo.com

IPAddress:61616 to activemq-api.testdemo.com

Now I can access ActiveMQ console from our company network using activemq-ui.testdemo.com. But couldn't access activemq-api.testdemo.com through Java code.

Getting Below Error:

SEVERE: Error Message: javax.jms.JMSException: Could not connect to broker URL: tcp://activemq-api.demo.com. Reason:
  java.lang.IllegalArgumentException: port out of range:-1

Error looks like expecting port number in the URL. But not sure what to pass for this.

Can anyone help me on how to access ActiveMQ API inside corporate network?

1
include the code for the producer and consumer seems like ports are not setup correctlyUlug Toprak
Do you have the full stack-trace for that error?Justin Bertram

1 Answers

1
votes

You need to provide the port that the client should attempt to connect to on the connection URI as the error is telling you, something like:

tcp://activemq-api.demo.com:80 

The client does not attempt to guess or deduce what the port is you want it to use and so that field is mandatory.