commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james_strac...@yahoo.co.uk>
Subject [messenger] Re: Messagelets problems !
Date Tue, 28 May 2002 23:52:17 GMT
Messagelets problems !Hi Romulus

I've CC'd the commons-dev list in case others might find this interesting. From inside a Servlet
you should be able to use the following code to send a message to some server via JMS, then
block until a response comes back. 

Messenger messenger = MessengerManager.get( "myConnection" );
Destination destination = messenger.getDestination( "jms/Queue" );
TextMessage message = messenger.createTextMessage( "this is some text, maybe even XML" );
Message response = messenger.call( destination, message );

The above will wait until the response is sent from the server process. For details of how
to write the server side, to consume a message from a queue then send a response, there are
examples using either a Messagelet, a Message Driven Object or even a Servlet here:-

http://cvs.apache.org/viewcvs/jakarta-commons-sandbox/messenger/src/webapp/src/

The configuration files required to deploy the server side in a Servlet container are here

http://cvs.apache.org/viewcvs.cgi/jakarta-commons-sandbox/messenger/src/webapp/conf/

James
  ----- Original Message ----- 
  From: romulus tudose 
  To: jstrachan@apache.org 
  Sent: Tuesday, May 28, 2002 9:25 PM
  Subject: Messagelets problems !


  Hi James,



  I have to go back to you because our messagelet problem is still in same situation:

  we can not get the contact between the servlet and JMS.

  To explain you how it's look like: we have a servlet in one machine and a MOM installed

  in another one. The idea is to send an incoming request from web client via servlet

  to the MOM, this one [the listener connected to MOM] to process the information and 

  *send* back the response to servlet.

  Please help us with a very short example that I can polish [more development and 

  documented] and eventually if you are interested we can publish on the web side 

  because I'm sure that are more interested.

  >Looks good. You could add a topic="false" to the <jndi> element just in case the
JBossMQ implements both topic and queue i>nterfaces in the same connection factory class.



  >See the messenger/src/conf/MessengerJBoss.xml document for examples. This has been tested
by someone on JBossMQ >and it seemed to work



  >Sometimes the JNDI name for the connection factory or the queue needs to be prefixed
by "java:comp/env" or whatever for >official J2EE servers. Does that help?



  >The thing we are trying to accomplish is to consume JMS messages from a JMS Topic deployed
on the JMS Server. Using >plain JMS API calls with Servlets results in a IllegalStateException,
due to the sad fact that this is against the Servlet/J2EE >spec.



  Many thanks for your cooperation !

  Romulus Tudose

  Software Architect

  milliSolutions Holding AB (u.b.)


  * The information transmitted is intended only for the person or entity to which it is addressed
and may contain confidential and/or privileged material. Any review, retransmission, dissemination
or other use of, or taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received this in error, please
contact the sender and delete the material from any computer *


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message