You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Gisbert Amm <gi...@1und1.de> on 2009/02/26 13:30:31 UTC

How to communicate between two Spring-webapps in Tomcat within the same VM

Hi ActiveMQ list,

you provide really great software!

I'm sorry if I should ask something obvious, but I've read the manual
and the website up and down and couldn't find a hint.

I've got two webapps that are configured via Spring and deployt into
Tomcat. I want them to communicate with each other via ActiveMQ within
the same VM.

ATM, I'm using

<amq:networkConnector name="defaultNetworkConnector"
uri="multicast://default"/>

and

<amq:transportConnector name="defaultTransportConnector"
uri="tcp://@activemq.host@:@activemq.port@"
discoveryUri="multicast://default"/>

because I didn't find another solution for the first try (I could have
used peer:, but the target system is firewalled, so I set the ports
explicitly - the above syntax is for Maven filtering). This works like a
charm.

However, I don't really want two threads within the same VM to
communicate over TCP sockets. I tried vm:, but it didn't work. I was not
able to find out how the beans of my second webapp's context should be
configured to use the queues defined in the context of the first webapp.

Can somebody point me to an example or some documentation on how to
configure this setup with Spring?

That would be great.

Thank you,
Gisbert

------------------------------------------------------------------------------------------------------------
"Fact 23. One of the two most common causes of runaway projects is
unstable requirements. (Robert L. Glass)"
------------------------------------------------------------------------------------------------------------

Gisbert Amm
Softwareentwickler
Development Hosting - Integration

1&1 Internet AG | Elgendorfer Strasse 57 | 56410 Montabaur
FON: +49 721 / 91374-4224 | E-MAIL: gisbert.amm@1und1.de

Amtsgericht Montabaur HRB 6484

Vorstand: Henning Ahlert, Ralph Dommermuth, Matthias Ehrlich, Thomas
Gottschlich, Robert Hoffmann, Markus Huhn, Hans-Henning Kettler, Dr.
Oliver Mauss, Jan Oetjen
Aufsichtsratsvorsitzender: Michael Scheeren


Re: How to communicate between two Spring-webapps in Tomcat within the same VM

Posted by Dejan Bosanac <de...@nighttale.net>.
Hmmm that's strange. Maybe it's a classpath loading issue. Could you try
putting ActiveMQ jars in Tomcat's classpath instead of applications'?

Cheers
--
Dejan Bosanac

Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Thu, Feb 26, 2009 at 4:18 PM, Gisbert Amm <gi...@1und1.de> wrote:

> Hi Dejan,
>
> thank you for the quick response. I've tried the setup that you describe
> (same broker name in both apps) but found, that each application started
> it's own broker and they didn't communicate with each other. That's why
> I asked.
>
> -Gisbert
>
> Dejan Bosanac schrieb:
> > Hi Gisbert,
> >
> > VM transport is the solution you need. It's only important that you use
> the
> > same broker name in both applications.
> >
> > These two links should be enough to get ypu started
> >
> > http://activemq.apache.org/vm-transport-reference.html
> >
> http://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.html#HowdoIembedaBrokerinsideaConnection-UsingActiveMQConnectionFactory
> >
> > Cheers
> > --
> > Dejan Bosanac
> >
> > Open Source Integration - http://fusesource.com/
> > ActiveMQ in Action - http://www.manning.com/snyder/
> > Blog - http://www.nighttale.net
> >
> >
> > On Thu, Feb 26, 2009 at 1:30 PM, Gisbert Amm <gi...@1und1.de>
> wrote:
> >
> >> Hi ActiveMQ list,
> >>
> >> you provide really great software!
> >>
> >> I'm sorry if I should ask something obvious, but I've read the manual
> >> and the website up and down and couldn't find a hint.
> >>
> >> I've got two webapps that are configured via Spring and deployt into
> >> Tomcat. I want them to communicate with each other via ActiveMQ within
> >> the same VM.
> >>
> >> ATM, I'm using
> >>
> >> <amq:networkConnector name="defaultNetworkConnector"
> >> uri="multicast://default"/>
> >>
> >> and
> >>
> >> <amq:transportConnector name="defaultTransportConnector"
> >> uri="tcp://@activemq.host@:@activemq.port@"
> >> discoveryUri="multicast://default"/>
> >>
> >> because I didn't find another solution for the first try (I could have
> >> used peer:, but the target system is firewalled, so I set the ports
> >> explicitly - the above syntax is for Maven filtering). This works like a
> >> charm.
> >>
> >> However, I don't really want two threads within the same VM to
> >> communicate over TCP sockets. I tried vm:, but it didn't work. I was not
> >> able to find out how the beans of my second webapp's context should be
> >> configured to use the queues defined in the context of the first webapp.
> >>
> >> Can somebody point me to an example or some documentation on how to
> >> configure this setup with Spring?
> >>
> >> That would be great.
>
>

Re: How to communicate between two Spring-webapps in Tomcat within the same VM

Posted by Gisbert Amm <gi...@1und1.de>.
Hi Dejan,

thank you for the quick response. I've tried the setup that you describe
(same broker name in both apps) but found, that each application started
it's own broker and they didn't communicate with each other. That's why
I asked.

-Gisbert

Dejan Bosanac schrieb:
> Hi Gisbert,
> 
> VM transport is the solution you need. It's only important that you use the
> same broker name in both applications.
> 
> These two links should be enough to get ypu started
> 
> http://activemq.apache.org/vm-transport-reference.html
> http://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.html#HowdoIembedaBrokerinsideaConnection-UsingActiveMQConnectionFactory
> 
> Cheers
> --
> Dejan Bosanac
> 
> Open Source Integration - http://fusesource.com/
> ActiveMQ in Action - http://www.manning.com/snyder/
> Blog - http://www.nighttale.net
> 
> 
> On Thu, Feb 26, 2009 at 1:30 PM, Gisbert Amm <gi...@1und1.de> wrote:
> 
>> Hi ActiveMQ list,
>>
>> you provide really great software!
>>
>> I'm sorry if I should ask something obvious, but I've read the manual
>> and the website up and down and couldn't find a hint.
>>
>> I've got two webapps that are configured via Spring and deployt into
>> Tomcat. I want them to communicate with each other via ActiveMQ within
>> the same VM.
>>
>> ATM, I'm using
>>
>> <amq:networkConnector name="defaultNetworkConnector"
>> uri="multicast://default"/>
>>
>> and
>>
>> <amq:transportConnector name="defaultTransportConnector"
>> uri="tcp://@activemq.host@:@activemq.port@"
>> discoveryUri="multicast://default"/>
>>
>> because I didn't find another solution for the first try (I could have
>> used peer:, but the target system is firewalled, so I set the ports
>> explicitly - the above syntax is for Maven filtering). This works like a
>> charm.
>>
>> However, I don't really want two threads within the same VM to
>> communicate over TCP sockets. I tried vm:, but it didn't work. I was not
>> able to find out how the beans of my second webapp's context should be
>> configured to use the queues defined in the context of the first webapp.
>>
>> Can somebody point me to an example or some documentation on how to
>> configure this setup with Spring?
>>
>> That would be great.


Re: How to communicate between two Spring-webapps in Tomcat within the same VM

Posted by Dejan Bosanac <de...@nighttale.net>.
Hi Gisbert,

VM transport is the solution you need. It's only important that you use the
same broker name in both applications.

These two links should be enough to get ypu started

http://activemq.apache.org/vm-transport-reference.html
http://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.html#HowdoIembedaBrokerinsideaConnection-UsingActiveMQConnectionFactory

Cheers
--
Dejan Bosanac

Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Thu, Feb 26, 2009 at 1:30 PM, Gisbert Amm <gi...@1und1.de> wrote:

> Hi ActiveMQ list,
>
> you provide really great software!
>
> I'm sorry if I should ask something obvious, but I've read the manual
> and the website up and down and couldn't find a hint.
>
> I've got two webapps that are configured via Spring and deployt into
> Tomcat. I want them to communicate with each other via ActiveMQ within
> the same VM.
>
> ATM, I'm using
>
> <amq:networkConnector name="defaultNetworkConnector"
> uri="multicast://default"/>
>
> and
>
> <amq:transportConnector name="defaultTransportConnector"
> uri="tcp://@activemq.host@:@activemq.port@"
> discoveryUri="multicast://default"/>
>
> because I didn't find another solution for the first try (I could have
> used peer:, but the target system is firewalled, so I set the ports
> explicitly - the above syntax is for Maven filtering). This works like a
> charm.
>
> However, I don't really want two threads within the same VM to
> communicate over TCP sockets. I tried vm:, but it didn't work. I was not
> able to find out how the beans of my second webapp's context should be
> configured to use the queues defined in the context of the first webapp.
>
> Can somebody point me to an example or some documentation on how to
> configure this setup with Spring?
>
> That would be great.
>
> Thank you,
> Gisbert
>
>
> ------------------------------------------------------------------------------------------------------------
> "Fact 23. One of the two most common causes of runaway projects is
> unstable requirements. (Robert L. Glass)"
>
> ------------------------------------------------------------------------------------------------------------
>
> Gisbert Amm
> Softwareentwickler
> Development Hosting - Integration
>
> 1&1 Internet AG | Elgendorfer Strasse 57 | 56410 Montabaur
> FON: +49 721 / 91374-4224 | E-MAIL: gisbert.amm@1und1.de
>
> Amtsgericht Montabaur HRB 6484
>
> Vorstand: Henning Ahlert, Ralph Dommermuth, Matthias Ehrlich, Thomas
> Gottschlich, Robert Hoffmann, Markus Huhn, Hans-Henning Kettler, Dr.
> Oliver Mauss, Jan Oetjen
> Aufsichtsratsvorsitzender: Michael Scheeren
>
>