i am using JBOSS 3.2.3 
(please dont rush me to upgrade, we are using this in operational mode, so huge 
testing to be done for migration)

Am confused by the same issue. Would the following code do in order for the 
publish of message to Topic to be part of transaction.

---------------------------------------------------------------------------------
        try{
            TopicConnectionFactory qcf = (TopicConnectionFactory) 
                (new InitialContext().lookup("java:/JmsXA"));
            TopicConnection conn;
                conn = qcf.createTopicConnection();
            Topic queue = (Topic) (new 
InitialContext().lookup("topic/"+topicName));
            TopicSession session = (TopicSession)
                    conn.createTopicSession(true, 
TopicSession.AUTO_ACKNOWLEDGE);
            
            TopicPublisher send = session.createPublisher(queue);
            MapMessage message = session.createMapMessage();
            message.setString("action", action);
            
            Enumeration keys = param.keys();
            while(keys.hasMoreElements()){
                String key = (String) keys.nextElement();
                message.setObject(key, param.get(key));
            }                  
            send.publish(message);  
            
            send.close();
            session.close();
            conn.close();
        }catch(JMSException e1){
                StringBuffer log = new StringBuffer();
                log.append("Error during publishing of message to Topic: ");
                log.append(topicName);
                log.append(", for action: ");
                log.append(action);
            logger.error(log.toString(), e1);   
        } catch (NamingException e) {
                StringBuffer log = new StringBuffer();
                log.append("Error during publishing of message to Topic: ");
                log.append(topicName);
                log.append(", for action: ");
                log.append(action);
            logger.error(log.toString(), e);   
        }
----------------------------------------------------------------------------------

The whole process i would like to achieve is as follows:
1. Servlet to Call on SessionBean to perform operations including database 
write.
2. SessionBean call on utility class to publish Message to a Topic. Utility 
class is normal bean. And the above contain in utility class.
3. MDB used as listener to the Topic. MDB will perform operations including 
retrieval of data written in Step 1.

I've initially use 'ConnectionFactory' instead of 'java:/JmsXA'. It caused 
problem because occasionally, during Step 3, the data retrieved wasnt the most 
up-to-date that has been commited in Step 1.

After much ploughing through the forum, i've change the codes to the above.

Would anyone mind to shed some light whether the above would solve my problem? 
It's a little hard to replicate the problem due to the random nature. Thus am 
not completely sure whether i've fixed the error.

Thanks much.

Veny

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3912013#3912013

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3912013


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to