我有以下结构。
<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.根据我的知识,它应该增加。能否帮我找到上述代码的错误。
答案 0 :(得分: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>