spring integration:int-jdbc:outbound-gateway commit?

时间:2014-10-21 11:52:09

标签: spring-integration

我试图理解当我们使用jdbc出站网关的任何插入或更新语句时提交如何工作,有时我们看到进程标志没有更新,任何输入都会非常有用

<int-jdbc:outbound-gateway id="update.gateway"
            request-channel="request.channel" reply-channel="reply.channel"
            data-source="dataSource" request-sql-parameter-source-factory="spelSource"
            update="update table set PROCESS_FLAG=:processFlag where QUEUE_VALUE=:queueValue and
                     JOB_ID=:jobId ">
</int-jdbc:outbound-gateway>

1 个答案:

答案 0 :(得分:0)

如何将您的流量转移到Transaction

假设我们在开头有一个<gateway>,你可以这样开始:

public Bar service(Foo foo) {
    return this.gateway.store(foo);
}

因此,只有@Transactional方法标记该方法。

从另一边<int-jdbc:outbound-gateway><request-handler-advice-chain>。你可以放tx:advice

<int-jdbc:outbound-gateway>
   <int-jdbc:request-handler-advice-chain>
        <tx:advice>
            <tx:attributes>
                <tx:method name="*"/>
            </tx:attributes>
        </tx:advice>
   </int-jdbc:request-handler-advice-chain>
</int-jdbc:outbound-gateway>

无论如何需要事务才能获得DB UPDATE的正确结果。