Hi,
You can simply add
marshaler="#marshaler"
transacted="jms"
attribute for your jms consumer to enable transaction.
here the marshaler is,
<bean id="marshaler"
class="org.apache.servicemix.jms.endpoints.DefaultConsumerMarshaler">
<property name="mep" value="http://www.w3.org/2004/08/wsdl/in-out
" />
<property name="rollbackOnError" value="true"/>
</bean>
notice you must set <property name="rollbackOnError" value="true"/>
then when a Error message back to your jms consumer, the jms comsumer
will do rollback.
Freeman
On 2010-4-10, at 下午12:26, gnanda wrote:
Hi,
I am a newbie in servicemix.
I am using servicemix 4 (apache-servicemix-4.0.0) . I have created a
service
assembly with 3 SUs. The flow is as below
JMS consumer ->servicemix Bean class-> http provider (accessing
external
webservice). I like to understand how would I impose transactional
capability the the above message flow
For example: if I receive any error (or fault) while calling the
external
service from http provider component then I should be able to
rollback or
commit the message to the queue based one the error code.
Any insight will be very helpful. Thank you in advance.
Here is my xbean definition of jms consumer
<jms:consumer service="test:MyConsumerService" endpoint="jms"
targetService="test:MyBeanConsumerService"
targetEndpoint="beanendpoint"
destinationName="spq2" connectionFactory="#connectionFactory"
concurrentConsumers="4" cacheLevel="3" />
<bean id="connectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616" />
<!--
not working <property name="redeliveryPolicy"
ref="redeliveryPolicy"
/>
-->
</bean>
<bean id="redeliveryPolicy"
class="org.apache.activemq.RedeliveryPolicy">
<property name="maximumRedeliveries" value="8" />
</bean>
Here is my xbean definition of the bean class
<bean:endpoint service="test:MyBeanConsumerService"
endpoint="beanendpoint"
bean="#myBean"/>
<bean id="myBean" class="org.simpleBeanconsumer.MyBean"/>
</beans>
Here is my xbean definition of the http provider
<http:endpoint service="test:TemperatureConverterService1"
endpoint="TemperatureConverterServiceSoap12Binding"
role="provider"
locationURI="http://localhost/axis2/services/TemperatureConverterService
"
defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
/>
<!--
wsdlResource="http://localhost/axis2/services/TemperatureConverterService?wsdl
"
-->
</beans>
--
View this message in context:
http://old.nabble.com/SMX4-handling-transaction-tp28199896p28199896.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
--
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com