[ 
https://issues.apache.org/activemq/browse/AMQ-731?page=comments#action_36241 ] 

David Jencks commented on AMQ-731:
----------------------------------

I assume you mean mutliple jta transactions rather than multiple branches of a 
single jta transaction.  In this case something else such as the connector 
framework is responsible for delisting the connection(s) from the first tx and 
enlisting them in the 2nd tx.  IIRC this is stated rather unclearly in the jta 
spec and slightly more clearly but in terms of c programming in the xa spec.

In geronimo we normally don't do this.  The only time you can change 
transactions with suspend/resume is going into an ejb RequiresNew method and in 
this case we just give you new connections.  There is an experimental way of 
delisting connections and reusing them in the new transaction, but AFAIK no one 
has ever used it.  What are the circumstances that lead Resin to suspend/resume?

> Redeliveries don't work with resource adapter and Jencks
> --------------------------------------------------------
>
>          Key: AMQ-731
>          URL: https://issues.apache.org/activemq/browse/AMQ-731
>      Project: ActiveMQ
>         Type: Bug

>   Components: Connector
>     Versions: 4.0
>  Environment: Sun JDK 1.5.0_06, Jencks 1.1.3, AMQ 4.0, Resin Pro 3.0.14
>     Reporter: Christopher G. Stach II

>
>
> During a rollback in a JTA transaction, this exception is generated a few 
> times:
> org.apache.activemq.broker.AbstractConnection.serviceException Async
> error occurred: javax.jms.JMSException: Could not correlate
> acknowledgment with dispatched message: MessageAck {commandId = 137,
> responseRequired = false, ackType = 1, consumerId =
> ID:xxx-2276-1148335783189-2:5:-1:2, firstMessageId =
> ID:xxx-2276-1148335783189-2:1:1:1:2, lastMessageId =
> ID:xxx-2276-1148335783189-2:1:1:1:2, destination = queue://xxxQueue,
> transactionId = null, messageCount = 1}
> javax.jms.JMSException: Could not correlate acknowledgment with
> dispatched message: MessageAck {commandId = 137, responseRequired =
> false, ackType = 1, consumerId = ID:xxx-2276-1148335783189-2:5:-1:2,
> firstMessageId = ID:xxx-2276-1148335783189-2:1:1:1:2, lastMessageId =
> ID:xxx-2276-1148335783189-2:1:1:1:2, destination = queue://xxxQueue,
> transactionId = null, messageCount = 1}
>         at
> org.apache.activemq.broker.region.PrefetchSubscription.acknowledge(PrefetchSubscription.java:175)
>         at
> org.apache.activemq.broker.region.AbstractRegion.acknowledge(AbstractRegion.java:233)
>         at
> org.apache.activemq.broker.region.RegionBroker.acknowledge(RegionBroker.java:362)
>         at
> org.apache.activemq.broker.TransactionBroker.acknowledge(TransactionBroker.java:176)
>         at
> org.apache.activemq.broker.BrokerFilter.acknowledge(BrokerFilter.java:65)
>         at
> org.apache.activemq.broker.BrokerFilter.acknowledge(BrokerFilter.java:65)
>         at
> org.apache.activemq.broker.MutableBrokerFilter.acknowledge(MutableBrokerFilter.java:78)
>         at
> org.apache.activemq.broker.AbstractConnection.processMessageAck(AbstractConnection.java:356)
>         at org.apache.activemq.command.MessageAck.visit(MessageAck.java:178)
>         at
> org.apache.activemq.broker.AbstractConnection.service(AbstractConnection.java:201)
>         at
> org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:62)
>         at
> org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:97)
>         at
> org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:63)
>         at
> org.apache.activemq.transport.vm.VMTransport.oneway(VMTransport.java:76)
>         at
> org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:44)
>         at
> org.apache.activemq.transport.ResponseCorrelator.oneway(ResponseCorrelator.java:60)
>         at
> org.apache.activemq.ActiveMQConnection.asyncSendPacket(ActiveMQConnection.java:1111)
>         at
> org.apache.activemq.ActiveMQSession.asyncSendPacket(ActiveMQSession.java:1655)
>         at
> org.apache.activemq.ActiveMQSession$2.afterRollback(ActiveMQSession.java:720)
>         at
> org.apache.activemq.TransactionContext.afterRollback(TransactionContext.java:134)
>         at
> org.apache.activemq.TransactionContext.rollback(TransactionContext.java:409)
>         at
> org.apache.activemq.ra.LocalAndXATransaction.rollback(LocalAndXATransaction.java:126)
>         at
> org.apache.geronimo.transaction.manager.WrapperNamedXAResource.rollback(WrapperNamedXAResource.java:78)
>         at
> com.caucho.transaction.TransactionImpl.rollbackInt(TransactionImpl.java:787)
>         at
> com.caucho.transaction.TransactionImpl.commit(TransactionImpl.java:560)
>         at org.jencks.XAEndpoint.afterDelivery(XAEndpoint.java:103)
>         at
> org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.afterDelivery(MessageEndpointProxy.java:125)
>         at
> org.apache.activemq.ra.MessageEndpointProxy.afterDelivery(MessageEndpointProxy.java:64)
>         at
> org.apache.activemq.ra.ServerSessionImpl.afterDelivery(ServerSessionImpl.java:214)
>         at org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:751)
>         at
> org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:163)
>         at com.caucho.jca.WorkThread.run(WorkThread.java:99)
>         at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:490)
>         at com.caucho.util.ThreadPool.run(ThreadPool.java:423)
>         at java.lang.Thread.run(Thread.java:595) 
> Note that the ackType is a poison ack.  This shouldn't be the case as the 
> configuration (below) on the resource adapter and the managed connection 
> factory both specify 9 redeliveries.  Redelivery does not happen.
> Broker configuration:
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://activemq.org/config/1.0";>
>         <broker persistent="false" useJmx="false">
>                 <transportConnectors>
>                         <transportConnector uri="vm://localhost" />
>                 </transportConnectors>
>                 <persistenceAdapter>
>                         <memoryPersistenceAdapter />
>                 </persistenceAdapter>
>         </broker>
> </beans>
> Spring configuration:
>         <bean id="jms.connectionFactory"
> class="org.springframework.jca.support.LocalConnectionFactoryBean">
>                 <property name="connectionManager">
>                         <bean 
> class="com.xxx.jca.ResinConnectionManagerFactoryBean">
>                                 <property name="localTransaction">
>                                         <value>false</value>
>                                 </property>
>                                 <property name="localTransactionOptimization">
>                                         <value>false</value>
>                                 </property>
>                                 <property name="managedConnectionFactory">
>                                         <ref 
> local="jms.managedConnectionFactory" />
>                                 </property>
>                                 <property name="xaTransaction">
>                                         <value>true</value>
>                                 </property>
>                         </bean>
>                 </property>
>                 <property name="managedConnectionFactory">
>                         <ref local="jms.managedConnectionFactory" />
>                 </property>
>         </bean>
>         <bean id="jms.jcaContainer" class="org.jencks.JCAContainer">
>                 <property name="bootstrapContext">
>                         <bean 
> class="com.xxx.jca.ResinBootstrapContextFactoryBean" />
>                 </property>
>                 <property name="resourceAdapter">
>                         <ref local="jms.resourceAdapter" />
>                 </property>
>         </bean>
>         <bean id="jms.managedConnectionFactory"
> class="org.apache.activemq.ra.ActiveMQManagedConnectionFactory">
>                 <property name="allPrefetchValues">
>                         <value>1</value>
>                 </property>
>                 <property name="initialRedeliveryDelay">
>                         <value>2000</value>
>                 </property>
>                 <property name="maximumRedeliveries">
>                         <value>9</value>
>                 </property>
>                 <property name="redeliveryBackOffMultiplier">
>                         <value>2</value>
>                 </property>
>                 <property name="redeliveryUseExponentialBackOff">
>                         <value>true</value>
>                 </property>
>                 <property name="resourceAdapter">
>                         <ref local="jms.resourceAdapter" />
>                 </property>
>         </bean>
>         <bean id="jms.broker" 
> class="org.apache.activemq.xbean.BrokerFactoryBean">
>                 <property name="config">
>                         <value>classpath:activemq.xml</value>
>                 </property>
>                 <property name="start">
>                         <value>true</value>
>                 </property>
>         </bean>
>         <bean id="jms.resourceAdapter"
> class="org.apache.activemq.ra.ActiveMQResourceAdapter"
> depends-on="jms.broker">
>                 <property name="allPrefetchValues">
>                         <value>1</value>
>                 </property>
>                 <property name="initialRedeliveryDelay">
>                         <value>2000</value>
>                 </property>
>                 <property name="maximumRedeliveries">
>                         <value>9</value>
>                 </property>
>                 <property name="redeliveryBackOffMultiplier">
>                         <value>2</value>
>                 </property>
>                 <property name="redeliveryUseExponentialBackOff">
>                         <value>true</value>
>                 </property>
>                 <property name="serverUrl">
>                         <value>vm://localhost</value>
>                 </property>
>         </bean>
> I have written a test case using Geronimo's TM, but it succeeds.  The 
> configuration is very different, so I don't think it can be attributed to 
> just a simple change in TM.  A lot of other configuration changes had to be 
> made.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to