Discussion:
How to use ActiveMQ Artemis through HTTP tunnel
Simon Martinelli, 72 Services LLC
2018-08-09 09:05:10 UTC
Permalink
Hi,



I configured a Netty http acceptor in my ActiveMQ Artemis Broker.



According to the Artemis examples I must add ?httpEnabled=true to enable HTTP.

I'm using Spring Boot and create a ActiveMQComponent like this:



@Bean

public ActiveMQComponent activemqAmazon() {

ActiveMQComponent activeMQComponent = new ActiveMQComponent();

activeMQComponent.setBrokerURL("tcp://amazonaws.com:8080?httpEnabled=true");

return activeMQComponent;

}



But then I get:

javax.jms.JMSException: Could not create Transport. Reason: java.lang.IllegalArgumentException: Invalid connect parameters: {httpEnabled=true}



Any help is appreciated.



Thanks, Simon
Quinn Stevenson
2018-08-10 14:08:00 UTC
Permalink
Just a guess - but I don’t think httpEnabled is a valid option for an ActiveMQ openwire connection - at least I don’t see it here http://activemq.apache.org/connection-configuration-uri.html <http://activemq.apache.org/connection-configuration-uri.html>
Post by Simon Martinelli, 72 Services LLC
Hi,
I configured a Netty http acceptor in my ActiveMQ Artemis Broker.
According to the Artemis examples I must add ?httpEnabled=true to enable HTTP.
@Bean
public ActiveMQComponent activemqAmazon() {
ActiveMQComponent activeMQComponent = new ActiveMQComponent();
activeMQComponent.setBrokerURL("tcp://amazonaws.com:8080?httpEnabled=true");
return activeMQComponent;
}
javax.jms.JMSException: Could not create Transport. Reason: java.lang.IllegalArgumentException: Invalid connect parameters: {httpEnabled=true}
Any help is appreciated.
Thanks, Simon
Simon Martinelli, 72 Services LLC
2018-08-10 14:21:51 UTC
Permalink
Hi Quinn,

It's an option of Artemis https://activemq.apache.org/artemis/ to connect to Netty using a HTTP tunnel.

Thanks, Simon

-----Original Message-----
From: Quinn Stevenson <***@pronoia-solutions.com>
Sent: Freitag, 10. August 2018 16:08
To: ***@camel.apache.org
Subject: Re: How to use ActiveMQ Artemis through HTTP tunnel

Just a guess - but I don’t think httpEnabled is a valid option for an ActiveMQ openwire connection - at least I don’t see it here http://activemq.apache.org/connection-configuration-uri.html <http://activemq.apache.org/connection-configuration-uri.html>
Post by Simon Martinelli, 72 Services LLC
Hi,
I configured a Netty http acceptor in my ActiveMQ Artemis Broker.
According to the Artemis examples I must add ?httpEnabled=true to enable HTTP.
@Bean
public ActiveMQComponent activemqAmazon() {
ActiveMQComponent activeMQComponent = new ActiveMQComponent();
activeMQComponent.setBrokerURL("tcp://amazonaws.com:8080?httpEnabled=true");
return activeMQComponent;
}
javax.jms.JMSException: Could not create Transport. Reason: java.lang.IllegalArgumentException: Invalid connect parameters: {httpEnabled=true}
Any help is appreciated.
Quinn Stevenson
2018-08-13 13:44:26 UTC
Permalink
If I’m understanding you correctly, you’re trying to create a Camel ActiveMQCompoent - which is a specialized implementation of the Camel JMS component for ActiveMQ 5.x. So I don’t think you have access to the Netty HTTP transport for Artemis using this component - maybe try Camel JMS?
Post by Simon Martinelli, 72 Services LLC
Hi Quinn,
It's an option of Artemis https://activemq.apache.org/artemis/ to connect to Netty using a HTTP tunnel.
Thanks, Simon
-----Original Message-----
Sent: Freitag, 10. August 2018 16:08
Subject: Re: How to use ActiveMQ Artemis through HTTP tunnel
Just a guess - but I don’t think httpEnabled is a valid option for an ActiveMQ openwire connection - at least I don’t see it here http://activemq.apache.org/connection-configuration-uri.html <http://activemq.apache.org/connection-configuration-uri.html>
Post by Simon Martinelli, 72 Services LLC
Hi,
I configured a Netty http acceptor in my ActiveMQ Artemis Broker.
According to the Artemis examples I must add ?httpEnabled=true to enable HTTP.
@Bean
public ActiveMQComponent activemqAmazon() {
ActiveMQComponent activeMQComponent = new ActiveMQComponent();
activeMQComponent.setBrokerURL("tcp://amazonaws.com:8080?httpEnabled=true");
return activeMQComponent;
}
javax.jms.JMSException: Could not create Transport. Reason: java.lang.IllegalArgumentException: Invalid connect parameters: {httpEnabled=true}
Any help is appreciated.
Thanks, Simon
Simon Martinelli, 72 Services LLC
2018-08-13 15:03:17 UTC
Permalink
So how do I have to configure the JmsComponent for Artemi
Quinn Stevenson
2018-08-13 16:11:37 UTC
Permalink
There are quite a few examples of configuring camel-jms in the tests - here’s one that may be close (https://github.com/apache/camel/blob/master/components/camel-jms/src/test/resources/org/apache/camel/component/jms/jmsRouteUsingSpringJMSTemplate.xml <https://github.com/apache/camel/blob/master/components/camel-jms/src/test/resources/org/apache/camel/component/jms/jmsRouteUsingSpringJMSTemplate.xml>).

You’ll need to use the Artemis ConnectionFactory (https://activemq.apache.org/artemis/docs/javadocs/javadoc-1.1.0/org/apache/activemq/artemis/jms/client/ActiveMQConnectionFactory.html <https://activemq.apache.org/artemis/docs/javadocs/javadoc-1.1.0/org/apache/activemq/artemis/jms/client/ActiveMQConnectionFactory.html>) rather than the ActiveMQ 5.x connection factory in order to set the httpEnabled property.

HTH
So how do I have to configure the JmsComponent for Artemis?
I didn't find any examples.
Thanks, Simon
Simon Martinelli, 72 Services LLC
2018-08-13 16:58:08 UTC
Permalink
Thanks Quinn.

Sending now works with this configuration:

@Bean
public ActiveMQComponent activemqAmazon() {
if (System.getProperty("http.proxyUser") != null) {
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(System.getProperty("http.proxyUser"), System.getProperty("http.proxyPassword").toCharArray());
}
});
}

ActiveMQComponent activeMQComponent = new ActiveMQComponent();
activeMQComponent.setJmsOperations(camelJmsTemplate());
return activeMQComponent;
}

@Bean
public JmsConfiguration.CamelJmsTemplate camelJmsTemplate() {
JmsConfiguration jmsConfiguration = new JmsConfiguration();
JmsConfiguration.CamelJmsTemplate camelJmsTemplate = new JmsConfiguration.CamelJmsTemplate(jmsConfiguration, activeMQConnectionFactory());
return camelJmsTemplate;
}

@Bean
public ActiveMQConnectionFactory activeMQConnectionFactory() {
ActiveMQConnectionFactory activeMQConnectionFactory = new ActiveMQConnectionFactory("tcp://x.eu-central-1.compute.amazonaws.com:8080?httpEnabled=true");
return activeMQConnectionFactory;
}

But if I create a route that should consume messages it doesn't

from("activemqAmazon:UnitTopic")
.id(UnitTopicRemoteToUnitMasterTopicRoute.class.getSimpleName())
.log("Processing: ${body}")
.to("activemqLocal:topic:UnitMasterTopic");

I even don't see any connections the management console.

How do I have to configure my endpoint to
Quinn Stevenson
2018-08-13 17:07:15 UTC
Permalink
I haven’t ever tried this, so I’m guessing. But have you tried using the JmsComponent instead of the ActiveMQComponent?
Post by Simon Martinelli, 72 Services LLC
activemqAmazon
Simon Martinelli, 72 Services LLC
2018-08-13 17:13:55 UTC
Permalink
Oh you are right! With JmsComponent it works.
Thank you very much for your help.

My config looks like:

@Bean
public JmsComponent activemqAmazon() {
JmsComponent jmsComponent = new JmsComponent();
jmsComponent.setConnectionFactory(activeMQConnectionFactory());
return jmsComponent;
}

@Bean
public ActiveMQConnectionFactory activeMQConnectionFactory() {
ActiveMQConnectionFactory activeMQConnectionFactory = new ActiveMQConnectionFactory("tcp://x.eu-central-1.compute.amazonaws.com:8080?httpEnabled=true");
return activeMQConnectionFactory;
}

And because of the HTTP tunnel I see:

2018-08-13 19:12:17.058 WARN 8924 --- [umer[UnitTopic]] c.c.j.DefaultJmsMessageListenerContainer : Setup of JMS message listener invoker failed for destination 'UnitTopic' - trying to recover. Cause: Session is closed
2018-08-13 19:12:17.153 INFO 8924 --- [umer[UnitTopic]] c.c.j.DefaultJmsMessageListenerContainer : Successfully refreshed JMS Connection

But I assume that this WARN is ok because of the HTTP t

Loading...