Mantenha a transação no fluxo de integração do Spring
Gateway Inboud:
<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>
Definição do conselho:
<tx:advice id="advice">
<tx:attributes>
<tx:method name="send" propagation="REQUIRES_NEW" rollback-for="MyClassException"/>
</tx:attributes>
</tx:advice>
Configuração do conselho:
<aop:config>
<aop:advisor advice-ref="advice" pointcut="bean(transactional.channel.input)"/>
</aop:config>
Cadeia que precisa ser transacional:
<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>
Chain que precisa que a transação seja executada anteriormente para obter o id do objeto gerado na última etapa da cadeia transacional:
<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>
Tendo este contexto simplificado, quando acesso ao id no serviço getObjectId, a transação não foi executada.
Portanto, a transação parece ser confirmada no nível de saída do gateway de entrada.