spring integration - int-jms:message-driven-channel-adapter and acknowledge="transacted" -


i have message driven channel adapter configured pick messages queue acknowledge set transacted. possible send different messages different queues down stream holding same transaction have database inserts between in flow?. if message delivery fails queue , transaction must roll (including database entries) message send other queues.

example : queue(receive)--->insert db-->send to(queue1,queue2.. etc sending different message each queue)

if send call fails queue1, queue2 etc transaction should roll back..

i able configuration single queue (ie queue1). how if multiple queues involved , holding transaction boundaries.

thanks vaidya

below configuration

                                                              <int-jms:message-driven-channel-adapter     id="messagedrivenadapter" channel="injmschannel" destination="testq"     concurrent-consumers="5" max-concurrent-consumers="10" acknowledge="transacted"     error-channel="error" />  <int:channel id="injmschannel" />  <int:chain input-channel="injmschannel" id="chain1">       <int-jpa:retrieving-outbound-gateway         entity-class="entity.testtable8"         entity-manager-factory="entitymanagerfactory" id-expression="payload.getsno()">         <int-jpa:transactional transaction-manager="transactionmanager" />     </int-jpa:retrieving-outbound-gateway>      <int:recipient-list-router id="route_1_2">         <int:recipient channel="successchannel"             selector-expression="payload.getsno()==1" />             /> -->     </int:recipient-list-router>  </int:chain>  <int:channel id="successchannel" />   <int:chain id="messageprocessingchain" input-channel="successchannel"     output-channel="putmsgchannel">      <int:service-activator id="a1" ref="taskexe"         method="processtable8_1" requires-reply="true" />      <int-jpa:retrieving-outbound-gateway         id="table7" entity-class="entity.testtable7"         entity-manager-factory="entitymanagerfactory" id-expression="payload.getsno()">         <int-jpa:transactional transaction-manager="transactionmanager" />     </int-jpa:retrieving-outbound-gateway>      <int:service-activator id="a2" ref="taskexe"         method="processtable8_2" requires-reply="true" />      <int-jpa:updating-outbound-gateway         id="table6" entity-class="entity.testtable6"         entity-manager-factory="entitymanagerfactory" flush="true">         <int-jpa:transactional transaction-manager="transactionmanager" />     </int-jpa:updating-outbound-gateway>      <int:service-activator id="a3" ref="taskexe"         method="processtable6_1" requires-reply="true" />      <int-jpa:updating-outbound-gateway         id="uptable6" entity-class="entity.testtable6"         entity-manager-factory="entitymanagerfactory" flush="true">         <int-jpa:transactional transaction-manager="transactionmanager" />     </int-jpa:updating-outbound-gateway>      <int:service-activator id="a4" ref="taskexe"         method="processtable6_2" requires-reply="true" />        <int-jpa:updating-outbound-gateway         id="uptable4" entity-class="entity.testtable4"         entity-manager-factory="entitymanagerfactory" flush="true">         <int-jpa:transactional transaction-manager="transactionmanager" />     </int-jpa:updating-outbound-gateway>        <int:service-activator ref="taskexe" method="processtable4_1"         requires-reply="true" />    </int:chain>  <int:channel id="putmsgchannel" />  <int-jms:outbound-channel-adapter id="sendsomemsg"     channel="putmsgchannel" connection-factory="connectionfactory"     session-transacted="true" destination-expression="headers['somequeue']" /> 

how add int-jms:outbound-channel-adapte other queue having same transaction boundaries of message driven adapter?. flush=true been set message not passed downstream if there jpa adapter exception.

as long queue sends performed using jmstemplate (including use of jms outbound channel adapter), on same thread, performed in same transactional session message-driven adapter's message delivery.

if add jdbc transaction manager message-driven adapter, transaction synchronized jms transaction.

this provides "best effort 1pc" discussed in dave syer's javaworld article: distributed transactions in spring, , without xa.

there small possibility db commit succeed , jms commit fails, need deal duplicates. avoid need full xa solution.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -