我尝试创建一个结合了发布策略方法和聚合器方法的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
除外)