Hi!
I am having issues suppressing errors in my Gateway error flow. Instead of just rolling back the inner tx, I get "Transaction rolled back because it has been marked as rollback-only" and everything is rolled back.
Flow overview:
Poller -> Start Outer Tx (Propagation REQUIRED) -> getList -> Slitter -> StartInnerTx(propagation REQUIRES_NEW) ->
->DoStuff -> StopInnerTx -> aggregator -> StopOuterTx
Problem:
Exception occurring in "DoStuff" does not only rollback the inner tx but also causes "Transaction rolled back because it has been marked as rollback-only".
GW configuration:
TransactionalGateway interface looks like this:Code:<si:service-activator input-channel="startOuterTX.in" output-channel="nullChannel" ref="outerGW" method="sendInTx" /> <si:gateway id="outerGW" service-interface="com.example.si.gateway.TransactionalGateway" default-request-channel="toSplitter" default-reply-channel="stopOuterTX.in" /> <si:service-activator input-channel="startInnerTx.in" output-channel="aggregateSplittedMessages" ref="innerGW" method="sendInNewTx" /> <si:gateway id="innerGW" service-interface="com.example.si.gateway.TransactionalGateway" default-request-channel="doStuff" error-channel="innerGwErrorChannel.in" />
The inner GW error handling flow only tries to create a success response. No reply channel set in the xml.Code:public interface TransactionalGateway { @Transactional public Message<?> sendInTx(Message<?> msg); @Transactional(propagation=Propagation.REQUIRES_NEW) public Message<?> sendInNewTx(Message<?> msg); }
I have tried a lot of different error transformation code as I am unsure which header values that should be set on the outgoing message. It either results in the gateway hanging as an incorrect reply header is set or I get the "transaction marked as rollback only"-exception.Code:<si:transformer input-channel="innerGwErrorChannel.in" ref="errorTransformer" method="transformErrorToFailedMessage" />
Here is one example of error transformation code I tried:
Any ideas how the error flow for an inner gateway should be configured to avoid exception to propagate upwards?Code:return message.getPayload().getFailedMessage();
The REQUIRES_NEW transaction configuration seems to be ok. At least the logs says that the inner tx is rolled back and closed and then that the suspended outer transaction is resumed.
All ideas are welcome![]()


Reply With Quote