activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From roman hawk <romanh...@gmail.com>
Subject Re: HTTP Tunneling for Embedded Broker
Date Thu, 29 Oct 2009 11:26:31 GMT

I'm pretty new to ActiveMQ code and architecture.

I've managed to create the working sample, but it is more a hack than
solution.
HttpTunnelServlet requires TransportAcceptListener which essentially serves
as a connection to broker. If your broker is running inside your VM, you
have VMTransportServer-based connector. Which in turn has a reference to its
TransportAcceptListener (private!).

So I managed to take this listener and feed it to HttpTunnelServlet.

So Http is tunneling to "in-VM" transport in this case. Looks pretty ugly,
though.

Still I'm not sure if it is possible to pass "servlet-reference" to
HttpTransportServer as it is created from URL in doBind function.

Maybe current implemntation is intended for Broker-Broker integration when
internal broker should be used as a proxy for connection with external
broker?


Dejan Bosanac wrote:
> 
> Hi,
> 
> you're right, looks like HttpTransportServer needs some refactoring to
> support binding the servlet to the existing servlet container. It'd be
> great
> to have this in ActiveMQ, can you raise a Jira for it? I'm willing to help
> you with this, but due to other pending tasks, can't start working on it
> immidiatelly. It's be faster if you tried to create a patch you need.
> 
> Cheers
> --
> Dejan Bosanac - http://twitter.com/dejanb
> 
> Open Source Integration - http://fusesource.com/
> ActiveMQ in Action - http://www.manning.com/snyder/
> Blog - http://www.nighttale.net
> 
> 
> On Thu, Oct 29, 2009 at 10:53 AM, roman hawk <romanhawk@gmail.com> wrote:
> 
>>
>> Hello, thanks for your response.
>>
>> I've checked HttpEmbeddedTunnelServlet.
>>
>>            if (broker == null) {
>>                broker = createBroker();
>>
>>                // Add the servlet connector
>>                String url = getConnectorURL();
>>                transportConnector = new HttpTransportServer(new
>> URI(url));
>>                broker.addConnector(transportConnector);
>>
>>                String brokerURL =
>> getServletContext().getInitParameter("org.apache.activemq.brokerURL");
>>                if (brokerURL != null) {
>>                    log("Listening for internal communication on: " +
>> brokerURL);
>>                }
>>            }
>>            broker.start();
>>
>> So HttpTransportServer is created for http://localhost/...
>> And then in HttpTransportServer new jetty server is started. So, I'm
>> still
>> in the situation when 2 Http servers are running. One is mine (where I
>> put
>> my Servlet), and another is embedded Jetty.
>>
>>
>>
>>
>> Dejan Bosanac wrote:
>> >
>> > Hi,
>> >
>> > did you check  HttpEmbeddedTunnelServlet and
>> > HttpSpringEmbeddedTunnelServlet? It might be what you're looking for.
>> >
>> > Cheers
>> > --
>> > Dejan Bosanac - http://twitter.com/dejanb
>> >
>> > Open Source Integration - http://fusesource.com/
>> > ActiveMQ in Action - http://www.manning.com/snyder/
>> > Blog - http://www.nighttale.net
>> >
>> >
>> > On Thu, Oct 29, 2009 at 6:34 AM, roman hawk <romanhawk@gmail.com>
>> wrote:
>> >
>> >>
>> >> I've the following use case:
>> >> According to ActiveMQ docs and code, it is possible to open http
>> >> transport
>> >> from broker. Jetty server is started inside HttpTransportServer.
>> Listener
>> >> from HttpTransportServer is registered in HttpTunnelServlet, which is
>> >> started inside Jetty.
>> >>
>> >> I have an embedded broker. It is running essentially inside my servlet
>> >> container. So I'd like to reuse my servlet container (thus port 80) to
>> >> open
>> >> HttpTunnel. So it looks like correct approach is to start
>> >> HttpTunnelServlet
>> >> inside my container. The only connection with broker is
>> >> TransportAcceptListener. I've obtained this listener from
>> >> VMTransportServer,
>> >> but I guess it is not the best approach (private field).
>> >>
>> >> What is the best approach from architecture perspective? Create my own
>> >> transport? Use some Transport filter? Or am I missing something?
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/HTTP-Tunneling-for-Embedded-Broker-tp26107111p26107111.html
>> >> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>> > -----
>> > Dejan Bosanac
>> >
>> > Open Source Integration - http://fusesource.com/
>> > ActiveMQ in Action - http://www.manning.com/snyder/
>> > Blog - http://www.nighttale.net
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/HTTP-Tunneling-for-Embedded-Broker-tp26107111p26110103.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -----
> Dejan Bosanac
> 
> Open Source Integration - http://fusesource.com/
> ActiveMQ in Action - http://www.manning.com/snyder/
> Blog - http://www.nighttale.net
> 

-- 
View this message in context: http://www.nabble.com/HTTP-Tunneling-for-Embedded-Broker-tp26107111p26111266.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message