简体   繁体   English

Mule JDBC更新间歇性地工作

[英]Mule JDBC update works intermittently

I need to constantly update a table in a loop and it works fine most of the times but once in a while Mule does update the table but it is not committed. 我需要不断地循环更新一个表,大多数情况下它都能正常工作,但有时Mule会更新表,但未提交。

So, here is my flow. 所以,这是我的流程。 I poll a table where the flag is 0. Once it is polled, flag is set to 5. After calling a service, flag is set to 1. But if the service call fails, the flag is set back to 0 so that it'll be re-polled and processed. 我轮询一个标志为0的表。一旦对其进行轮询,则将标志设置为5。调用服务后,将标志设置为1。但是,如果服务调用失败,则将标志设置回0,以便将其设置为0。将重新轮询和处理。

If the service is down for few minutes, then this loop should keep going till the service is up. 如果服务关闭了几分钟,则此循环应继续进行直到服务启动。 The below statement works mostly fine, but sometimes it doesn't update and the loop is broken. 下面的语句在大多数情况下都可以正常工作,但是有时它不会更新并且循环中断。

Not sure whether it is Mule or DriverManager issue. 不确定是Mule还是DriverManager问题。

<jdbc-ee:outbound-endpoint queryTimeout="-1"  queryKey="updateEventReset" connector-ref="DatabaseEvents" exchange-pattern="one-way" doc:name="Database"/>

Flow: 流:

<mule>
<spring:bean id="jdbcEASDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
</spring:bean>
<jdbc-ee:connector dataSource-ref="jdbcEASDataSource" name="DatabaseEvents" transactionPerMessage="true" validateConnections="true" queryTimeout="-1" pollingFrequency="10000" doc:name="Database">
    <receiver-threading-profile maxThreadsActive="1"/>
    <jdbc-ee:query key="selectEvent" value="select * from EVENT_TEST where PROCESSED = 0 ORDER BY RowId" />
    <jdbc-ee:query key="selectEvent.ack" value="update EVENT_TEST set PROCESSED = 5 where RowId = #[map-payload:ROWID]" />
    <jdbc-ee:query key="updateEventProcessed" value="update EVENT_TEST set PROCESSED = 1 where RowId = #[flowVars['RowId']]" />
    <jdbc-ee:query key="updateEventReset" value="update EVENT_TEST set PROCESSED = 0 where PROCESSED = 5" />
</jdbc-ee:connector>
<flow name="EventLinkerDBPolling" doc:name="EventLinkerDBPolling" processingStrategy="synchronous">
    <jdbc-ee:inbound-endpoint queryKey="selectEvent" connector-ref="ISeriesDatabaseEvents" doc:name="ACSC Database"/>
    <vm:outbound-endpoint path="vm.toEventWSCall" exchange-pattern="one-way" doc:name="To Event Dining" />
</flow>
<flow name="EventWSProcessing" doc:name="EventWSProcessing" processingStrategy="synchronous">
      <vm:inbound-endpoint path="vm.toEventWSCall" exchange-pattern="one-way" doc:name="Event " >
        <vm:transaction action="NONE"/>
      </vm:inbound-endpoint>
      <set-variable variableName="RowId" value="#[map-payload:ROWID]" doc:name="Variable"/>
  <flow-ref name="ManagerClient" doc:name="Call  Flow Linker" />
      <jdbc-ee:outbound-endpoint queryKey="updateEventProcessed" connector-ref="DatabaseEvents" exchange-pattern="one-way" doc:name="Database"/>
  <catch-exception-strategy doc:name="Catch Exception Strategy">
    <choice doc:name="Choice">
        <when expression="#[ payload.getStatusCode() == 404 ]">
        <processor-chain>
            <jdbc-ee:outbound-endpoint queryTimeout="-1"  queryKey="updateEventReset" connector-ref="DatabaseEvents" exchange-pattern="one-way" doc:name="Database"/>
        </processor-chain>
        </when>
    </choice> 
  </catch-exception-strategy>
</flow>
</mule>

I had a similar problem and the issue turned out to be an internal Mule exception. 我有一个类似的问题,结果证明是内部Mule异常。 https://www.mulesoft.org/jira/browse/MULE-6889 https://www.mulesoft.org/jira/browse/MULE-6889

I can't see the foreach loop in your flow. 我看不到流程中的foreach循环。 How are you looping? 您如何循环播放? This exception is quite specific to for each loops. 对于每个循环,此异常是非常特定的。 By restructuring the flow I could relatively easy sort it out (after weeks of troubleshooting) 通过重组流程,我可以相对容易地进行分类(经过数周的故障排除)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM