Author |
Message
|
subhendu |
Posted: Tue Mar 12, 2002 7:08 am Post subject: |
|
|
Novice
Joined: 05 Mar 2002 Posts: 18
|
I want to call the message listener in the start up servlet. So that when a message arrives it will be taken care as servlet instance is running always.
IS this approach is correct ?? Can i achieve the same thing in different way.I am using WAS application server 3.5.
Thanks,
Subhendu |
|
Back to top |
|
 |
kolban |
Posted: Tue Mar 12, 2002 7:19 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2001 Posts: 1072 Location: Fort Worth, TX, USA
|
Although not a J2EE specialist, I am thinking that the purpose of a Servlet is to handle incoming Web based requests and that attempting to do other work (such as watching for incoming messages) in the context of a Servlet hosted by a web container is probably not what the J2EE designers had in mind. I suspect that a message driven bean (WAS 4.0 EE) is probably more in line with what you want. |
|
Back to top |
|
 |
subhendu |
Posted: Tue Mar 12, 2002 7:39 am Post subject: |
|
|
Novice
Joined: 05 Mar 2002 Posts: 18
|
I am using ejb1.1, so i can not use MDB. |
|
Back to top |
|
 |
ourtown |
Posted: Tue Mar 26, 2002 3:54 pm Post subject: |
|
|
 Acolyte
Joined: 05 Feb 2002 Posts: 67 Location: Somerset, NJ
|
It seems a waste to use an AppServer Servlet to host an MQ Service - why not just run standalone ?
However the approach will work as would writing an EJB not even an MDB. With an EJB you would have to get it running when the AppServer started but you would have more control over its behaviour
|
|
Back to top |
|
 |
middlewareonline |
Posted: Mon Apr 01, 2002 1:47 pm Post subject: |
|
|
Acolyte
Joined: 09 Jul 2001 Posts: 73
|
EJB wont; be able to handle this scenario ( that is why MDB was introduced). When you implment a bean a message listener it may behave strngley. As you have are setting the listener to a bean which may be passivated by container.
Also, as mentioned Servlet is to handle htpp requests. What you can do though is write an ejb client (outside of app server) have it implment a message listener interface (on message method) and do whatever you need to do from there. Keep in mind this process is outside the container so you will have to take care of failover etc.
Raj
_________________ ---------------------------------------------
IBM & SUN (J2EE) Certified Consultants,
http://www.MiddlewareOnline.com
A "SARVAM" Online Portal
http://www.SARVAM.com
--------------------------------------------- |
|
Back to top |
|
 |
ourtown |
Posted: Thu Jul 18, 2002 7:18 am Post subject: |
|
|
 Acolyte
Joined: 05 Feb 2002 Posts: 67 Location: Somerset, NJ
|
Just getting back to this thread after a long time
Running a message listener in a servlet is very reasonable - all you use are the start up and shutdown routines - the http capabilities are irrelevant.
The appserver ensure that the servlet starts when the appserver starts and stops with the appserver.
You then have a pattern that you can use for other message listeners and you dont have to configure MDB/EJBs to autostart, worry about keeping the bean active etc
Brian S. Crabtree
EAI Consultant |
|
Back to top |
|
 |
|