-
May 12th, 2009, 12:06 PM
#1
Read off Q and write to database as a transaction
Hi all,
Basically, I just want to know if the way I am doing this is correct or not. It seems to be treating the whole process as a single transaction but is there a better way? Something just seems a little disjointed, like how does the 'save' method know its part of the initial transaction, when the message is read from the Q?
I am reading off a Q
-------------------
<jms:inbound-channel-adapter id="jmsin"
destination="responseQueue"
channel="saveMailChannel"
connection-factory="connectionFactoryMQ">
<int
oller id="poller" default="true" max-messages-per-poll="1">
<int:interval-trigger interval="10000" />
<int:transactional propagation="REQUIRES_NEW" transaction-manager="transactionManager" />
</int
oller>
</jms:inbound-channel-adapter>
----------------------------------------------------
and then write to DB, the messageAdapter has a save method which calls the jdbc save method.
----------------------------------------------------
<int:channel id="saveMailChannel" />
<int:outbound-channel-adapter
channel="saveMailChannel"
ref="messageAdapter"
method="save"/>
================================================== ===============================
my concerns were valid, I am getting this error in WAS 6.1. Found that in my appserver config the heuristic applied is to ROLLBACK if a transaction is open for longer than 120s. A transaction timeout occurs and a rollback happens on the next XA operation. Its clear that I need to somehow wrap these steps into some sort of single operation. Can someone please assist with a pointer on how my SI config can be improved? Another idea I had, is to call commit on the save? But then I need a handle to the txManager? Am I on the right track here?
5/12/09 18:29:38:367 SAST] 00000011 TimeoutManage I WTRN0006W: Transaction 0000012135A695F50000000500000112F5603E64FED47E7B8B 57820397863671278FC3330000012135A695F5000000050000 0112F5603E64FED47E7B8B57820397863671278FC333000000 01 has timed out after 120 seconds.
[5/12/09 19:07:44:364 SAST] 0000002f SystemOut O INFO - PersistentMessageAdapterImpl.save(43) | Saving message f834882e-0573-49a2-b72f-e628bf53046d
[5/12/09 19:07:44:370 SAST] 0000002f XATransaction E J2CA0026E: Method addSync caught javax.transaction.RollbackException: Transaction rolled back
at com.ibm.ws.Transaction.JTA.TransactionImpl.registe rSynchronization(TransactionImpl.java:3546)
at com.ibm.ws.Transaction.JTA.TransactionImpl.registe rSynchronization(TransactionImpl.java:3525)
at com.ibm.ws.Transaction.JTA.TranManagerSet.register Synchronization(TranManagerSet.java:507)
at com.ibm.ejs.j2c.XATransactionWrapper.addSync(XATra nsactionWrapper.java:289)
at com.ibm.ejs.j2c.ConnectionManager.initializeForUOW (ConnectionManager.java:1290)
at com.ibm.ejs.j2c.ConnectionManager.involveMCInTran( ConnectionManager.java:1038)
at com.ibm.ejs.j2c.ConnectionManager.allocateConnecti on(ConnectionManager.java:602)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConn ection(WSJdbcDataSource.java:449)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConn ection(WSJdbcDataSource.java:418)
at org.springframework.jdbc.datasource.DataSourceUtil s.doGetConnection(DataSourceUtils.java:113)
at org.springframework.jdbc.datasource.DataSourceUtil s.getConnection(DataSourceUtils.java:79)
at org.springframework.jdbc.core.JdbcTemplate.execute (JdbcTemplate.java:577)
at org.springframework.jdbc.core.JdbcTemplate.execute (JdbcTemplate.java:619)
at org.appfuse.dao.jdbc.JdbcMessageDao.save(JdbcMessa geDao.java:120)
at org.appfuse.service.impl.PersistentMessageAdapterI mpl.save(PersistentMessageAdapterImpl.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.integration.util.DefaultMethod Invoker.invokeMethod(DefaultMethodInvoker.java:89)
at org.springframework.integration.handler.MessageMap pingMethodInvoker.doInvokeMethod(MessageMappingMet hodInvoker.java:133)
at org.springframework.integration.handler.MessageMap pingMethodInvoker.invokeMethod(MessageMappingMetho dInvoker.java:106)
at org.springframework.integration.handler.MethodInvo kingMessageHandler.handleMessage(MethodInvokingMes sageHandler.java:45)
at org.springframework.integration.dispatcher.Abstrac tDispatcher.sendMessageToHandler(AbstractDispatche r.java:85)
at org.springframework.integration.dispatcher.Abstrac tUnicastDispatcher.dispatch(AbstractUnicastDispatc her.java:54)
at org.springframework.integration.channel.AbstractSu bscribableChannel.doSend(AbstractSubscribableChann el.java:56)
at org.springframework.integration.channel.AbstractMe ssageChannel.send(AbstractMessageChannel.java:116)
at org.springframework.integration.channel.AbstractMe ssageChannel.send(AbstractMessageChannel.java:94)
at org.springframework.integration.channel.MessageCha nnelTemplate.doSend(MessageChannelTemplate.java:22 3)
at org.springframework.integration.channel.MessageCha nnelTemplate.send(MessageChannelTemplate.java:180)
at org.springframework.integration.endpoint.SourcePol lingChannelAdapter.doPoll(SourcePollingChannelAdap ter.java:78)
at org.springframework.integration.endpoint.AbstractP ollingEndpoint$Poller$2.doInTransaction(AbstractPo llingEndpoint.java:228)
at org.springframework.transaction.jta.WebSphereUowTr ansactionManager$UOWActionAdapter.run(WebSphereUow TransactionManager.java:306)
at com.ibm.ws.uow.UOWManagerImpl.runUnderNewUOW(UOWMa nagerImpl.java:948)
at com.ibm.ws.uow.UOWManagerImpl.runUnderUOW(UOWManag erImpl.java:509)
at org.springframework.transaction.jta.WebSphereUowTr ansactionManager.execute(WebSphereUowTransactionMa nager.java:252)
at org.springframework.transaction.support.Transactio nTemplate.execute(TransactionTemplate.java:122)
at org.springframework.integration.endpoint.AbstractP ollingEndpoint$Poller.innerPoll(AbstractPollingEnd point.java:226)
at org.springframework.integration.endpoint.AbstractP ollingEndpoint$Poller.poll(AbstractPollingEndpoint .java:216)
at org.springframework.integration.endpoint.AbstractP ollingEndpoint$Poller.run(AbstractPollingEndpoint. java:209)
at org.springframework.integration.scheduling.SimpleT askScheduler$ErrorHandlingRunnableWrapper.run(Simp leTaskScheduler.java:307)
at java.util.concurrent.Executors$RunnableAdapter.cal l(Executors.java:417)
at java.util.concurrent.FutureTask$Sync.innerRunAndRe set(FutureTask.java:280)
at java.util.concurrent.FutureTask.runAndReset(Future Task.java:135)
at org.springframework.integration.scheduling.SimpleT askScheduler$TriggeredTask.run(SimpleTaskScheduler .java:256)
at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExecutor.java:650)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
while trying to register the Resource Adapter with the Synchronization Manager for the current transaction, and threw a ResourceException.
Last edited by dudleygb; May 12th, 2009 at 12:23 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules