Spring 集成聚合错误

Spring Integration Aggregation Error

我有一个 spring 集成实现,其中我有两个客户端订阅者收听同一个 JMS 主题。我在两个实现中都使用 JDBC 消息存储(不同区域)来保存传入消息。处理数据时出现异常:

  org.springframework.dao.EmptyResultDataAccessException: Incorrect result size: expected 1, actual 0

我知道这是 Jira 问题:https://jira.spring.io/browse/INT-2912

目前无法升级Spring版本。我无法理解解决方法 "The work-around is either to always use a different groupKey or to use separate tables for each Message Store. We will need to add a REGION column to the INT_GROUP_TO_MESSAGE as well."

如何创建不同的 groupKey?

我的实现如下:

<bean
  id="jdbcMessageStore"
  class="org.springframework.integration.jdbc.JdbcMessageStore"
  p:dataSource-ref="datasource"
  p:region="REPORTS"/>  

<si:aggregator 
        send-partial-result-on-expiry="false" 
        message-store="jdbcMessageStore" 
        discard-channel="discardedLogger"/>

里面提到的"groupKey"是关联策略结果;默认情况下它只使用 correlationId header.

您可以使用 correlation-strategy-expression="'foo' + headers['correlationId']"correlation-strategy-expression="'bar' + headers['correlationId']" 为每个应用程序使用不同的组密钥。