我有以下结构.
<int:publish-subscribe-channel id="updateProjectRequest" />
<int:channel id="aggregate-project"/>
<int:service-activator input-channel="updateProjectRequest" output-channel="aggregate-project" ref="updateProjectResponseHandler" method="createFolder"/>
<int:service-activator input-channel="updateProjectRequest" output-channel="aggregate-project" ref="updateProjectResponseHandler" method="createRepo"/>
<int:aggregator input-channel="aggregate-project" ref="projectAggregator">
以下是我的Aggregator类.
@Component("projectAggregator")
public class ProjectAggregator {
@Aggregator
public boolean aggregatingMethod(List<Map<String, List<Project>>> items) {
//////// CODE //////
}
@ReleaseStrategy
public boolean releaseChecker(List<Message<?>> messages) {
//////CODE/////
}
@CorrelationStrategy
public Map<String, List<Project>> correlateBy(Map<String, List<Project>> item) {
return item;
}
问题是,如果我在@ReleaseStrategy方法中打印消息长度,它始终保持为1.根据我的知识,它应该增加.能否帮我找到上述代码的错误.
最佳答案 如果您以后想要聚合发送给发布/订阅者频道订阅者的消息,则需要将apply-sequence设置为true.
如果为true,则将correlationId和序列信息添加到消息头中.
<xsd:attribute name="apply-sequence" type="xsd:string" default="false">
<xsd:annotation>
<xsd:documentation>
Specify whether the sequence size, sequence number, and correlation id
headers should be set on
Messages that are sent through this channel.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>