You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by suchitha koneru <su...@gmail.com> on 2007/07/27 00:48:39 UTC

broker start up in Tomcat

Hello Tomcat Users,
                         I am using Tomcat server 5.5.20 along with Java 1.6,
and Active MQ 4.1.1.  There are two web applications A and B which
communicate via the active mq broker. Our application has a requirement of
starting the broker before any of the web apps. Where should I be placing
the code which starts the broker.  I can create a jar file out of the code
and dependent libraries and place it in common/lib. How will I communicate
to Tomcat server that the broker has to be started during the server  start
up  process, before any of the web apps ? Any pointers  in this regard ?

thank you ,
Suchitha.

Re: broker start up in Tomcat

Posted by suchitha koneru <su...@gmail.com>.
Thank you so much Johnny for the idea. We have two web apps A and B namely.
A is the front end of our application and B is the back end. Our application
is web based, so we have a lot of https requests coming from the browser. We
could have used a servlet for inter web app communication  , but a servlet
is visible to teh outside world. Our Messaging bus implemented using active
mq is confined to the JVM and is not accessible to the out side world. The
Web app A and Web app B have to keep each other updated and in sycn with
respect to the mutual  changes .They do it via the JMS Messaging Bus
implemented using active MQ.

On 7/26/07, Johnny Kewl <jo...@kewlstuff.co.za> wrote:
>
> I dont know ActiveMQ but I think you will have to allow "any" WebApp that
> needs it, to start it, if its not already running.... I think you have 2
> options, create a custom JNDI object or create a singleton start up object
> in common/lib, here is an article
> http://www.javacoffeebreak.com/articles/designpatterns/index.html
>
> Just remember that the lib is now shared and I imagine you call into this
> broker to send messages, if so remember to make it thread safe, it
> possibly
> is already.
>
> I am curious about what you using it for... I have still to find
> application
> for JMS in the TC environment, because sending a message to a servlet from
> an embedded http client has always served me well... its on port 80, so no
> firewall problems etc. I guess its because you have message beans in an
> application server somewhere.... just wondering.
>
> ----- Original Message -----
> From: "suchitha koneru" <su...@gmail.com>
> To: <us...@tomcat.apache.org>
> Sent: Friday, July 27, 2007 12:48 AM
> Subject: broker start up in Tomcat
>
>
> > Hello Tomcat Users,
> >                         I am using Tomcat server 5.5.20 along with Java
> > 1.6,
> > and Active MQ 4.1.1.  There are two web applications A and B which
> > communicate via the active mq broker. Our application has a requirement
> of
> > starting the broker before any of the web apps. Where should I be
> placing
> > the code which starts the broker.  I can create a jar file out of the
> code
> > and dependent libraries and place it in common/lib. How will I
> communicate
> > to Tomcat server that the broker has to be started during the server
> > start
> > up  process, before any of the web apps ? Any pointers  in this regard ?
> >
> > thank you ,
> > Suchitha.
> >
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: broker start up in Tomcat

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
I dont know ActiveMQ but I think you will have to allow "any" WebApp that 
needs it, to start it, if its not already running.... I think you have 2 
options, create a custom JNDI object or create a singleton start up object 
in common/lib, here is an article 
http://www.javacoffeebreak.com/articles/designpatterns/index.html

Just remember that the lib is now shared and I imagine you call into this 
broker to send messages, if so remember to make it thread safe, it possibly 
is already.

I am curious about what you using it for... I have still to find application 
for JMS in the TC environment, because sending a message to a servlet from 
an embedded http client has always served me well... its on port 80, so no 
firewall problems etc. I guess its because you have message beans in an 
application server somewhere.... just wondering.

----- Original Message ----- 
From: "suchitha koneru" <su...@gmail.com>
To: <us...@tomcat.apache.org>
Sent: Friday, July 27, 2007 12:48 AM
Subject: broker start up in Tomcat


> Hello Tomcat Users,
>                         I am using Tomcat server 5.5.20 along with Java 
> 1.6,
> and Active MQ 4.1.1.  There are two web applications A and B which
> communicate via the active mq broker. Our application has a requirement of
> starting the broker before any of the web apps. Where should I be placing
> the code which starts the broker.  I can create a jar file out of the code
> and dependent libraries and place it in common/lib. How will I communicate
> to Tomcat server that the broker has to be started during the server 
> start
> up  process, before any of the web apps ? Any pointers  in this regard ?
>
> thank you ,
> Suchitha.
> 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: broker start up in Tomcat

Posted by suchitha koneru <su...@gmail.com>.
Thank you  Len for the suggested approach . The web apps should be
abstracted from the procedure of starting the broker, otherwise I'll end up
adding a servlet context listener for every new web app added to our
application. If possible, Iam looking for a way , in which Tomcat would
start the broker without any involvement from web applications.


On 7/26/07, Len Popp <le...@gmail.com> wrote:
>
> Write a function in your shared lib that checks if Active MQ has been
> started yet, and starts it if not. Then, in each webapp add a
> ServletContextListener with a contextInitialized method that calls the
> aforementioned function. Thus, Active MQ will be initialized when the
> first webapp starts up, whichever it is.
> --
> Len
>
> On 7/26/07, suchitha koneru <su...@gmail.com> wrote:
> > Hello Tomcat Users,
> >                          I am using Tomcat server 5.5.20 along with Java
> 1.6,
> > and Active MQ 4.1.1.  There are two web applications A and B which
> > communicate via the active mq broker. Our application has a requirement
> of
> > starting the broker before any of the web apps. Where should I be
> placing
> > the code which starts the broker.  I can create a jar file out of the
> code
> > and dependent libraries and place it in common/lib. How will I
> communicate
> > to Tomcat server that the broker has to be started during the
> server  start
> > up  process, before any of the web apps ? Any pointers  in this regard ?
> >
> > thank you ,
> > Suchitha.
> >
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: broker start up in Tomcat

Posted by Len Popp <le...@gmail.com>.
Write a function in your shared lib that checks if Active MQ has been
started yet, and starts it if not. Then, in each webapp add a
ServletContextListener with a contextInitialized method that calls the
aforementioned function. Thus, Active MQ will be initialized when the
first webapp starts up, whichever it is.
-- 
Len

On 7/26/07, suchitha koneru <su...@gmail.com> wrote:
> Hello Tomcat Users,
>                          I am using Tomcat server 5.5.20 along with Java 1.6,
> and Active MQ 4.1.1.  There are two web applications A and B which
> communicate via the active mq broker. Our application has a requirement of
> starting the broker before any of the web apps. Where should I be placing
> the code which starts the broker.  I can create a jar file out of the code
> and dependent libraries and place it in common/lib. How will I communicate
> to Tomcat server that the broker has to be started during the server  start
> up  process, before any of the web apps ? Any pointers  in this regard ?
>
> thank you ,
> Suchitha.
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org