You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Simon Martinelli, 72 Services LLC" <si...@72.services> on 2018/08/09 09:05:10 UTC

How to use ActiveMQ Artemis through HTTP tunnel

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

RE: How to use ActiveMQ Artemis through HTTP tunnel

Posted by "Simon Martinelli, 72 Services LLC" <si...@72.services>.
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 tunnel.


Re: How to use ActiveMQ Artemis through HTTP tunnel

Posted by Quinn Stevenson <qu...@pronoia-solutions.com>.
I haven’t ever tried this, so I’m guessing.  But have you tried using the JmsComponent instead of the ActiveMQComponent?


> On Aug 13, 2018, at 10:58 AM, Simon Martinelli, 72 Services LLC <si...@72.services> wrote:
> 
> activemqAmazon


RE: How to use ActiveMQ Artemis through HTTP tunnel

Posted by "Simon Martinelli, 72 Services LLC" <si...@72.services>.
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 consume from this topic over http?

Thanks.

Re: How to use ActiveMQ Artemis through HTTP tunnel

Posted by Quinn Stevenson <qu...@pronoia-solutions.com>.
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

> On Aug 13, 2018, at 9:03 AM, Simon Martinelli, 72 Services LLC <si...@72.services> wrote:
> 
> So how do I have to configure the JmsComponent for Artemis?
> 
> I didn't find any examples.
> 
> Thanks, Simon 
> 


RE: How to use ActiveMQ Artemis through HTTP tunnel

Posted by "Simon Martinelli, 72 Services LLC" <si...@72.services>.
So how do I have to configure the JmsComponent for Artemis?

I didn't find any examples.

Thanks, Simon 


Re: How to use ActiveMQ Artemis through HTTP tunnel

Posted by Quinn Stevenson <qu...@pronoia-solutions.com>.
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?


> On Aug 10, 2018, at 8:21 AM, Simon Martinelli, 72 Services LLC <si...@72.services> wrote:
> 
> 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 <qu...@pronoia-solutions.com> 
> Sent: Freitag, 10. August 2018 16:08
> To: users@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>
> 
>> On Aug 9, 2018, at 3:05 AM, Simon Martinelli, 72 Services LLC <si...@72.services> wrote:
>> 
>> 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
> 


RE: How to use ActiveMQ Artemis through HTTP tunnel

Posted by "Simon Martinelli, 72 Services LLC" <si...@72.services>.
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 <qu...@pronoia-solutions.com> 
Sent: Freitag, 10. August 2018 16:08
To: users@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>

> On Aug 9, 2018, at 3:05 AM, Simon Martinelli, 72 Services LLC <si...@72.services> wrote:
> 
> 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


Re: How to use ActiveMQ Artemis through HTTP tunnel

Posted by Quinn Stevenson <qu...@pronoia-solutions.com>.
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>

> On Aug 9, 2018, at 3:05 AM, Simon Martinelli, 72 Services LLC <si...@72.services> wrote:
> 
> 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