spring integration - using gateway for starting transaction -
i have been following previous answers talk inserting gateway / service-activator start new transaction mid way in si processing. have tried below code reason not work, if point error in configuration please.
all threads seems waiting happen , sp outbound gateway not invoked, cant figure out what.
the idea here process each task produced splitter in thread pool under new transaction.
<int:splitter...output-channel="taskchannel"/> <int:channel id="taskchannel"> <int:dispatcher task-executor="taskexecutor"/> </int:channel> <int:gateway id="txgw" service-interface="com.some.test.starttransactionalgateway" default-request-channel="taskchannel" default-reply-channel="individualtask"> </int:gateway> <int:service-activator ref="txgw" input-channel="taskchannel" output-channel="individualtask" method="starttx" auto-startup="true"> </int:service-activator> <int-jdbc:stored-proc-outbound-gateway ...request-channel="individualtask" ..... interface starttransactionalgateway { @transactional message<?> starttx(message<?> m); }
default-request-channel="taskchannel"
gateway sending messages itself.
you can't mix channels in subflow main channels. need like...
<int:splitter...output-channel="taskchannel"/> <int:channel id="taskchannel"> <int:dispatcher task-executor="taskexecutor"/> </int:channel> <int:service-activator ref="txgw" input-channel="taskchannel" output-channel="wherewewanttheresultstogo" method="starttx" reply-timeout="0" auto-startup="true" /> <int:gateway id="txgw" service-interface="com.some.test.starttransactionalgateway" default-request-channel="tostoredproc" /> <int-jdbc:stored-proc-outbound-gateway ...request-channel="tostoredprod" .....
you don't need default-reply-channel
; omit reply-channel
on stored proc gateway , reply automatically go back.
Comments
Post a Comment