Hi I am trying to push messages to active mq via http transport.
The active mq is behind the proxy server which need authentication before pushing the message to external active mq.
is there a way I can set the proxy details to active mq connection.
I read some article where mentioned we can use HttpClientTrasport.
But i am not sure how to set the HttpClientTrasport to ActiveMQConnection object.
Thanks in advance.
if i understand you want to set the proxy config for org.apache.activemq.ActiveMQConnection ?
this can be set on org.apache.activemq.ActiveMQConnectionFactory.ActiveMQConnectionFactory(String brokerURL) level by passing the url with proxy config like this :
brokerURL = "http://localhost:8080?proxyHost=proxy&proxyPort=8080&proxyUser=user&proxyPassword=pwd"
if you have specials characters on user or pwd you need to change like this :
brokerURL = "http://localhost:8080?"+ URLEncoder.encode("proxyHost=proxy&proxyPort=8080&proxyUser=user&proxyPassword=pwd", "UTF-8");
hope this help
- add transportConnection configuration in activemq;
nano ~/apache-activemq-5.11.1/conf/activemq.xml
<transportConnector name="http" uri="http://0.0.0.0:8888?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
- use broker_url
private static final String DEFAULT_BROKER_URL = "http://localhost:8888";
- add dependency in project
<dependency><groupId>org.apache.activemq</groupId><artifactId>activemq-http</artifactId><version>5.11.1</version></dependency>