[jboss-user] [JBoss Messaging] - Configuring Destinations in MDB's
nkhadakk
do-not-reply at jboss.com
Thu Sep 13 16:21:21 EDT 2007
JBoss Messaging 1.3/ JBoss AS (4.2.1)
We have an incoming message Queue and a pool of MDB's listening. The MDB's process the data and have to post results onto another Queue. This is the code for the posting to the reply Queue:
| @Resource(mappedName = "java:/JmsXA")
| private static QueueConnectionFactory factory;
|
| @Resource(mappedName = "/queue/ResolvedUniversalResourceQueue")
| private static Queue destinationReply;
|
| public void onMessage( Message msg)
| {
| // Process incoming msg and get it ready to be sent outward
| //
| //
| qConnection = factory.createQueueConnection();
| QueueSession qSession = qConnection.createQueueSession( false, Session.DUPS_OK_ACKNOWLEDGE);
| QueueSender qSender = qSession.createSender( destinationReply);
| qSender.send( qSession.createObjectMessage( urimsg));
| qSender.close();
| }
|
a. Is it ok to create new QueueConnections every time ? Especially since i use the java:/JMSXA connection factory ?
b. Is it ok to create Sessions and QueueSender every single invoke ?
Is there any best practice for pooling/sharing Sessions and QueueSender ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4084220#4084220
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4084220
More information about the jboss-user
mailing list