You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Dominique DE VITO <do...@thalesgroup.com> on 2007/03/08 16:37:24 UTC
putting 2 components (WS=>XSLT) into a transaction
Hi,
I want to put in a "transaction" the following execution:
WS (queue reader)=>XSLT (transformation)
so that if the second compoment fails (e.g. in case of a bad XSLT
transformation), the JMS message is not consumed and stays in the queue.
I have read SEDA flows support: Synchronous+Transactional
<http://incubator.apache.org/servicemix/transactions.html>
My "conf" repository is like the original/distrib one.
My ServiceMix pipeline is quite simple and defined as below.
I am testing with a bad XSLT transformation. Result = the JMS message is
consumed if the second stage fails.
Does someone have an idea ?
Many thanks.
Regards,
Dominique
NB : My ServiceMix pipeline is like :
<!-- FACTORY BEAN -->
<bean id="connectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="${activemq.url}" />
</bean>
<!-- the JBI container -->
<sm:container id="jbi"
rootDir="./data/smx"
MBeanServer="#jmxServer"
installationDirPath="./install"
deploymentDirPath="./deploy"
monitorInterval="1"
transactionManager="#transactionManager"
createJmxConnector="false"
depends-on="jndi"
flowName="seda"
autoEnlistInTransaction="true">
<sm:flows>
<sm:sedaFlow />
</sm:flows>
...
<sm:activationSpec componentName="inputReceiver_1">
<sm:component>
<jms:component>
<jms:endpoints>
<jms:endpoint
role="consumer"
endpoint="jmsbeginningpoint"
service="foo:myJmsReceiver_1"
connectionFactory="#connectionFactory"
jmsProviderDestinationName="queue_1"
destinationStyle="queue"
targetService="foo:transformer"
defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
synchronous="true"
/>
</jms:endpoints>
</jms:component>
</sm:component>
</sm:activationSpec>
<sm:activationSpec service="foo:transformer" componentName="transformer"
endpoint="transformer"
destinationService="foo:myJmsSender_2">
<sm:component>
<bean class="org.apache.servicemix.components.xslt.XsltComponent">
<property name="xsltResource" value="transf_demo.xsl" />
</bean>
</sm:component>
</sm:activationSpec>
Re: putting 2 components (WS=>XSLT) into a transaction
Posted by Dominique DE VITO <do...@thalesgroup.com>.
Guillaume Nodet wrote :
> I think that in your scenario, no transaction is started.
> You should configure the jms consumer to use JCA instead
> of plain jms. This would ensure a transaction is started by the
> jms component, the message consumption would be enlisted
> in the transaction, and the transaction would be sent with the
> exchange to the next step...
>
> On 3/8/07, Dominique DE VITO <do...@thalesgroup.com> wrote:
> [stuff]
I have just started to use JMS with JCA according to the distrib examples.
[1] => my 2nd step pipeline definition
[2] => the error I've got when running this step.
Thanks for any help.
Regards,
Dominique
[1] my ""JMS/queue reader=>XSLT transformation=>JMS/queue writer""
configuration
<!-- JMS Xa-enabled pooled factory -->
<amqpool:jcaPooledConnectionFactory
name="jmsFactory"
transactionManager="#transactionManager"
maxConnections="10"
brokerURL="${activemq.url}"
depends-on="broker" />
[...]
<sm:container id="jbi"
rootDir="./data/smx"
MBeanServer="#jmxServer"
installationDirPath="./install"
deploymentDirPath="./deploy"
monitorInterval="1"
transactionManager="#transactionManager"
createJmxConnector="false"
depends-on="jndi"
flowName="seda"
autoEnlistInTransaction="true">
<sm:activationSpec componentName="inputReceiver_1">
<sm:component>
<jms:component>
<jms:endpoints>
<jms:endpoint
role="consumer"
endpoint="jmsbeginningpoint_1"
service="foo:myJmsReceiver_1"
connectionFactory="#jmsFactory"
targetService="foo:transformer"
defaultMep="http://www.w3.org/2004/08/wsdl/in-only"
synchronous="true"
processorName="jca"
bootstrapContext="#bootstrapContext"
resourceAdapter="#activemqRA"
>
<jms:activationSpec>
<amqra:activationSpec destination="queue_1_1"
destinationType="javax.jms.Queue" />
</jms:activationSpec>
</jms:endpoint>
</jms:endpoints>
</jms:component>
</sm:component>
</sm:activationSpec>
<sm:activationSpec service="foo:transformer" componentName="transformer"
endpoint="transformer"
destinationService="foo:myJmsSender_2">
<sm:component>
<bean class="org.apache.servicemix.components.xslt.XsltComponent">
<property name="xsltResource" value="transf_demo.xsl" />
</bean>
</sm:component>
</sm:activationSpec>
<sm:activationSpec componentName="outputSender_2">
<sm:component>
<jms:component>
<jms:endpoints>
<jms:endpoint
role="provider"
endpoint="jmsendpoint_2"
service="foo:myJmsSender_2"
connectionFactory="#jmsFactory"
processorName="jca"
jmsProviderDestinationName="queue_2"
destinationStyle="queue"
>
</jms:endpoint>
</jms:endpoints>
</jms:component>
</sm:component>
</sm:activationSpec>
</sm:activationSpecs>
[2] see the error traces
java.lang.RuntimeException: Endpoint after delivery notification failure
at
org.apache.activemq.ra.ServerSessionImpl.afterDelivery(ServerSessionImpl.java:218)
at org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:750)
at
org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:165)
at
org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:290)
at
org.apache.geronimo.connector.work.pool.NamedRunnable.run(NamedRunnable.java:32)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.IllegalStateException: Cannot log transactions
unles XAResources are named!
org.apache.activemq.ra.LocalAndXATransaction@1bb8694
at
org.apache.geronimo.transaction.manager.TransactionImpl$TransactionBranch.getResourceName(TransactionImpl.java:716)
at
org.apache.geronimo.transaction.log.HOWLLog.prepare(HOWLLog.java:254)
at
org.apache.geronimo.transaction.manager.TransactionImpl.internalPrepare(TransactionImpl.java:443)
at
org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionImpl.java:315)
at
org.apache.geronimo.transaction.manager.TransactionManagerImpl.commit(TransactionManagerImpl.java:264)
at org.jencks.XAEndpoint.afterDelivery(XAEndpoint.java:105)
at
org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.afterDelivery(MessageEndpointProxy.java:126)
at
org.apache.activemq.ra.MessageEndpointProxy.afterDelivery(MessageEndpointProxy.java:65)
at
org.apache.activemq.ra.ServerSessionImpl.afterDelivery(ServerSessionImpl.java:216)
... 7 more
INFO - ServerSessionImpl:0 - Endpoint failed to process
message. Reason: java.lang.RuntimeException: Endpoint after delivery
notification failure
DEBUG - ServerSessionImpl:0 - run loop end
DEBUG - ServerSessionImpl:0 - Run finished
DEBUG - ServerSessionImpl:0 - Work completed:
javax.resource.spi.work.WorkEvent[source=Work :ServerSessionImpl:0]
DEBUG - CachedIntrospectionResults - Found bean property 'type' of
type [java.lang.String]
DEBUG - CachedIntrospectionResults - Found bean property 'unknown'
of type [boolean]
DEBUG - CachedIntrospectionResults - Class
[org.apache.servicemix.jbi.logging.LogService] is cache-safe
DEBUG - CollectionFactory - Creating [java.util.LinkedHashMap]
DEBUG - ServerSessionImpl:1 - Endpoint failed to process message.
java.lang.RuntimeException: Endpoint after delivery notification failure
at
org.apache.activemq.ra.ServerSessionImpl.afterDelivery(ServerSessionImpl.java:218)
at org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:750)
at
org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:165)
at
org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:290)
at
org.apache.geronimo.connector.work.pool.NamedRunnable.run(NamedRunnable.java:32)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.IllegalStateException: Cannot log transactions
unles XAResources are named!
org.apache.activemq.ra.LocalAndXATransaction@1cb048e
at
org.apache.geronimo.transaction.manager.TransactionImpl$TransactionBranch.getResourceName(TransactionImpl.java:716)
at
org.apache.geronimo.transaction.log.HOWLLog.prepare(HOWLLog.java:254)
at
org.apache.geronimo.transaction.manager.TransactionImpl.internalPrepare(TransactionImpl.java:443)
at
org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionImpl.java:315)
at
org.apache.geronimo.transaction.manager.TransactionManagerImpl.commit(TransactionManagerImpl.java:264)
at org.jencks.XAEndpoint.afterDelivery(XAEndpoint.java:105)
at
org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.afterDelivery(MessageEndpointProxy.java:126)
at
org.apache.activemq.ra.MessageEndpointProxy.afterDelivery(MessageEndpointProxy.java:65)
at
org.apache.activemq.ra.ServerSessionImpl.afterDelivery(ServerSessionImpl.java:216)
... 7 more
INFO - ServerSessionImpl:1 - Endpoint failed to process
message. Reason: java.lang.RuntimeException: Endpoint after delivery
notification failure
Re: putting 2 components (WS=>XSLT) into a transaction
Posted by Guillaume Nodet <gn...@gmail.com>.
I think that in your scenario, no transaction is started.
You should configure the jms consumer to use JCA instead
of plain jms. This would ensure a transaction is started by the
jms component, the message consumption would be enlisted
in the transaction, and the transaction would be sent with the
exchange to the next step...
On 3/8/07, Dominique DE VITO <do...@thalesgroup.com> wrote:
>
> Hi,
>
> I want to put in a "transaction" the following execution:
> WS (queue reader)=>XSLT (transformation)
>
> so that if the second compoment fails (e.g. in case of a bad XSLT
> transformation), the JMS message is not consumed and stays in the queue.
>
> I have read SEDA flows support: Synchronous+Transactional
> <http://incubator.apache.org/servicemix/transactions.html>
>
> My "conf" repository is like the original/distrib one.
>
> My ServiceMix pipeline is quite simple and defined as below.
>
> I am testing with a bad XSLT transformation. Result = the JMS message is
> consumed if the second stage fails.
>
> Does someone have an idea ?
>
> Many thanks.
>
> Regards,
> Dominique
>
>
> NB : My ServiceMix pipeline is like :
>
> <!-- FACTORY BEAN -->
> <bean id="connectionFactory"
> class="org.apache.activemq.ActiveMQConnectionFactory">
> <property name="brokerURL" value="${activemq.url}" />
> </bean>
>
> <!-- the JBI container -->
> <sm:container id="jbi"
> rootDir="./data/smx"
> MBeanServer="#jmxServer"
> installationDirPath="./install"
> deploymentDirPath="./deploy"
> monitorInterval="1"
> transactionManager="#transactionManager"
> createJmxConnector="false"
> depends-on="jndi"
> flowName="seda"
> autoEnlistInTransaction="true">
>
> <sm:flows>
> <sm:sedaFlow />
> </sm:flows>
> ...
>
> <sm:activationSpec componentName="inputReceiver_1">
> <sm:component>
> <jms:component>
> <jms:endpoints>
> <jms:endpoint
> role="consumer"
> endpoint="jmsbeginningpoint"
> service="foo:myJmsReceiver_1"
> connectionFactory="#connectionFactory"
> jmsProviderDestinationName="queue_1"
> destinationStyle="queue"
> targetService="foo:transformer"
> defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
> synchronous="true"
> />
> </jms:endpoints>
> </jms:component>
> </sm:component>
> </sm:activationSpec>
>
>
> <sm:activationSpec service="foo:transformer" componentName="transformer"
> endpoint="transformer"
> destinationService="foo:myJmsSender_2">
> <sm:component>
> <bean class="org.apache.servicemix.components.xslt.XsltComponent">
> <property name="xsltResource" value="transf_demo.xsl" />
> </bean>
> </sm:component>
> </sm:activationSpec>
>
>
>
>
--
Cheers,
Guillaume Nodet
------------------------
Architect, LogicBlaze (http://www.logicblaze.com/)
Blog: http://gnodet.blogspot.com/