找不到带注释的方法,回到SequenceSizeReleaseStrategy

时间:2016-07-04 01:58:32

标签: spring-integration aggregate

我尝试创建一个结合了发布策略方法和聚合器方法的bean:

public class POJOSingleAggregatorStrategy{
  @Aggregator
  public Message spliceMessage(List<Message<?>> messages) {
    ...
  }

  @ReleaseStrategy
  public boolean canRelease(MessageGroup messageGroup) {
    ...
  }

}

<channel id="inputChannel"/>

<channel id="outputChannel"/>

<bean id="aggregatorStrategyBean" class="sample.POJOSingleAggregatorStrategy"/>

<aggregator id="completelyDefinedAggregator" input-channel="inputChannel" output-channel="outputChannel" send-partial-result-on-expiry="false" ref="aggregatorStrategyBean" method="spliceMessage"/>

如果没有配置release-strategy-method,该程序运行良好,但它会发出警告:

No annotated method found; falling back to SequenceSizeReleaseStrategy, target:sample.POJOSingleAggregatorStrategy, methodName:null

配置release-strategy-method="canRelease"后,该程序无效,并报告异常:java.lang.IllegalStateException: Failed to process message list

有人知道如何避免这种警告吗? (重写ReleaseStrategyFactoryBean除外)

1 个答案:

答案 0 :(得分:0)

确实很奇怪;我们有一个测试用例herehere执行相同的操作并且工作正常。

如果您可以发布一个简单的测试用例来重现问题,我们可以看看。

您还需要为IllegalStateException提供完整的堆栈跟踪。