Behalten Sie die Transaktion im Spring Integration-Flow bei
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>
Hinweisdefinition:
<tx:advice id="advice">
<tx:attributes>
<tx:method name="send" propagation="REQUIRES_NEW" rollback-for="MyClassException"/>
</tx:attributes>
</tx:advice>
Hinweis config:
<aop:config>
<aop:advisor advice-ref="advice" pointcut="bean(transactional.channel.input)"/>
</aop:config>
Kette, die transaktionell sein muss:
<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>
Kette, für die die Transaktion zuvor ausgeführt werden muss, um die Objekt-ID zu erhalten, die im letzten Schritt der transationalen Kette generiert wurde:
<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>
In diesem vereinfachten Kontext wurde die Transaktion nicht ausgeführt, wenn ich auf die ID im getObjectId-Dienst zugreife.
Die Transaktion scheint also auf der Ausgabeebene des Inbound-Gateways festgeschrieben zu sein.