Inboud gateway:
<int-http:inbound-gateway id="inbound.gateway" request-channel="transactional.channel.input" reply-channel="channel.output" error-channel="channel.error" request-payload-type="java.lang.String" </int-http:inbound-gateway>
Definition of recommendation:
<tx:advice id="advice"> <tx:attributes> <tx:method name="send" propagation="REQUIRES_NEW" rollback-for="MyClassException"/> </tx:attributes> </tx:advice>
Config tip:
<aop:config> <aop:advisor advice-ref="advice" pointcut="bean(transactional.channel.input)"/> </aop:config>
The chain that should be transactional:
<int:chain input-channel="transactional.channel.input" output-channel="non.transactional.channel.input> <int:service-activator ref="v1.registerUser.service" method="registerUser"/> <int:service-activator ref="v1.saveObject.service" method="saveObject"/> </int:chain>
The chain for which you want to complete the transaction earlier in order to get the identifier of the object generated at the last step of the transaction:
<int:chain input-channel="non.transactional.channel.input" output-channel="channel.output"> <int:service-activator ref="v1.getObjectId.service" method="getObjectId"/> <int:object-to-json-transformer/> </int:chain>
Having this simplified context, when I access the id in the getObjectId service, the transaction failed.
Thus, the transaction seems to be running at the output level of the inbound-gateway.
source share