[jboss-dev-forums] [Design of JCA on JBoss] - Re: JBPAPP-750 - Integration between AS and JBossMessaging 1

vickyk do-not-reply at jboss.com
Wed Apr 9 09:22:49 EDT 2008


"adrian at jboss.org" wrote : 
  | Why? What's the use case?
  | 

I am considering the following jsp as the use case , it contains the similar code what was present in the testcase that failed ;)

<%@page import="javax.naming.*,javax.jms.*,org.jboss.tm.TransactionManagerLocator,javax.transaction.*,org.jboss.tm.TxUtils"%>
  | <%
  |      Queue queue = (Queue) new InitialContext().lookup("queue/testQueue");
  |      ConnectionFactory cf = (ConnectionFactory) new InitialContext().lookup("java:TestJmsLocal");
  |      TransactionManager tm = TransactionManagerLocator.getInstance().locate();
  |      tm.begin();
  | 	
  |       try
  |       {
  | 	 out.println(tm.getTransaction()+"Transaction status --->"+TxUtils.getStatusAsString(tm.getTransaction().getStatus())+"<br>");
  |          Connection c = cf.createConnection();
  | 	 out.println(tm.getTransaction()+"Transaction status --->"+TxUtils.getStatusAsString(tm.getTransaction().getStatus())+"<br>");
  |          try
  |          {
  |             c.start();
  | 	    out.println(tm.getTransaction()+"Transaction status --->>>>>>>>"+TxUtils.getStatusAsString(tm.getTransaction().getStatus())+"<br>");	
  |             Session s = c.createSession(true, Session.SESSION_TRANSACTED);
  |     	    
  | 	    out.println(tm.getTransaction()+"Transaction status -------->"+TxUtils.getStatusAsString(tm.getTransaction().getStatus())+"<br>");
  |          }
  |          finally
  |          {
  |             try
  |             {
  |                c.close();
  |             }
  |             catch (Exception ignored)
  |             {
  |             }
  |          }
  |       }
  |       finally
  |       {
  | 	 out.println(tm.getTransaction()+"Transaction status --->"+TxUtils.getStatusAsString(tm.getTransaction().getStatus())+"<br>");
  |   	 try{
  |          	tm.commit();
  | 	 }
  | 	 catch(Exception exp)
  | 	 {
  | 		out.println("EXP is "+exp+"caused by: "+exp.getCause());
  | 		exp.printStackTrace();
  | 	 }
  |  	out.println(tm.getTransaction());
  |       }
  | %>

Should the above jsp work for the following CF definition ?
<tx-connection-factory>
  |     <jndi-name>TestJmsLocal</jndi-name>
  |     <rar-name>jms-ra.rar</rar-name>
  |     <connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>
  |     <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
  |     <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/TestJMSLocalProvider</config-property>
  |     <max-pool-size>20</max-pool-size>
  |     <application-managed-security/>
  |   </tx-connection-factory>


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

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



More information about the jboss-dev-forums mailing list