【问题标题】:Spring integration, update INT_MESSAGE_GROUP got Lock wait timeout exceeded exceptionSpring 集成,更新 INT_MESSAGE_GROUP 得到 Lock wait timeout exceeded 异常
【发布时间】:2021-07-26 10:03:58
【问题描述】:

我正在使用 spring 集成,有时我会遇到以下异常:

org.springframework.messaging.MessageDeliveryException{failed to send Message to channel 'milestoneChannel'; 
nested exception is org.springframework.dao.CannotAcquireLockException: PreparedStatementCallback; SQL [UPDATE INT_MESSAGE_GROUP set UPDATED_DATE=? where GROUP_KEY=? and REGION=?]; 
 Lock wait timeout exceeded;
 try restarting transaction; nested exception is com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: 
Lock wait timeout exceeded; try restarting transaction, failedMessage=GenericMessage....

这是我的部分spring配置文件

  <int:channel id="milestoneChannel">
    <int:queue message-store="dataMessageStore"/>
  </int:channel>
  .....
   <si-xml:xpath-router id="messageRouter" default-output-channel="filterHistoryChannel" resolution-required="false">
  <si-xml:xpath-expression expression="//messageType"/>
  <si-xml:mapping value="MILESTONE" channel="mlestoneChannel"/>
  <si-xml:mapping value="JOB_INFO" channel="jobInfoChannel"/>
</si-xml:xpath-router>
......

【问题讨论】:

    标签: spring-integration


    【解决方案1】:

    考虑使用JdbcChannelMessageStore 而不是专用的MySqlChannelMessageStoreQueryProviderhttps://docs.spring.io/spring-integration/docs/current/reference/html/jdbc.html#jdbc-message-store-channels。这是专门为QueueChannel 操作设计的,所以你应该很好。

    另一个不相关的问题:不要尝试使用这么多QueueChannels。看起来该路由器的逻辑不应该从队列开始。更多的是你的mlestoneChannel 也是QueueChannel。这对于默认的TaskScheduler 来说是太多的线程转移和压力。

    【讨论】:

      猜你喜欢
      • 2015-10-29
      • 1970-01-01
      • 2016-09-13
      • 2018-08-30
      • 2011-06-14
      • 2013-03-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多