聚合器末尾的消息不可用 [英] Message not available at end of Aggregator

查看:25
本文介绍了聚合器末尾的消息不可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

构建了一个 Spring Integration 应用程序并传输了一些消息和 尝试将它们与聚合器结合在一起.应用程序到达了 Aggregator,但没有提供我想要的具体内容,我不会释放该组并进入下一步.

I have built a Spring Integration application and transferred some messages around and tried to bring them together with an Aggregator. The application reaches the Aggregator but does not deliver exactly what I want specifically I do not release the group and move onto the next step.

然而,我的问题是我的聚合器没有原始消息(来自 Splitter 之前).我的聚合器定义如下

My problem however is my aggregator doesn't have the original message (from before the Splitter). My aggregator is defined as follows

<int:aggregator input-channel="deirBoxProcessorToAggregatorChannel" 
                 ref="loggingAggregator" method="logAggregation"
                 output-channel="aggregatorToTransformer" 
                 expire-groups-upon-completion="true"/>

而且里面的代码如下..

public class LoggingAggregator {

private static final Logger LOGGER = Logger.getLogger(LoggingAggregator.class);

public void logAggregation(Message<File> message) {
    LOGGER.info("Have aggregated messsages. Will archive");
}

我在那个方法中的消息,虽然它进入了它,但总是null.

My message in that method, although it enters it, is always null.

<int:splitter input-channel="transformerToSplitterChannel" 
              ref="fileToMessageSplitter"
              output-channel="shippedSplitterToRouterChannel" 
              method="split" apply-sequence="true"/>

<!-- Now use a router to determine which Message builder these messages are sent onto -->
<int:router input-channel="shippedSplitterToRouterChannel" 
              ref="shippedToTypeRouter" />

<int:transformer input-channel="deirShippedBoxToTransformerChannel" 
               ref="shippedBoxTransformer" method="transform" output-
               channel="deirShippedTransformerToProcessorChannel"/>

<int:service-activator id="wellFormedShippedBoxProcess" 
                input-channel="deirShippedTransformerToProcessorChannel"
                output-channel="deirBoxProcessorToAggregatorChannel"
                ref="deirShippedFileProcessor" method="processBox" />

<int:service-activator id="malformedShippedBoxProcess"
                input-channel="deirMalformedShippedTransformerToProcessorChannel"
                output-channel="deirBoxProcessorToAggregatorChannel"
                ref="deirShippedFileProcessor" 
                method="processMalformedBox" />

<int:aggregator input-channel="deirBoxProcessorToAggregatorChannel" 
                ref="loggingAggregator" method="logAggregation"
                output-channel="aggregatorToTransformer" 
                expire-groups-upon-completion="true"/>

<int:transformer expression="headers.file_originalFile" 
                input-channel="aggregatorToTransformer"
                output-channel="transformerToArchiver" />

<int-file:outbound-channel-adapter id="deirArchiver" 
                channel="transformerToArchiver"
                directory="${dataexhange.springintg.refactor.archive.dir}"
                delete-source-files="true"/>

该过程一直到达聚合器,但似乎没有经过 TransformerOutboundChannelAdapter 存档器.

The process gets all the way to the Aggregator but does not seem to make it past to the Transformer or OutboundChannelAdapter archiver.

提前致谢.

推荐答案

您的 LoggingAggregator 不正确.我建议您阅读 参考手册.你的 logAggregation 方法应该是这样的:

Your LoggingAggregator isn't correct. I recommend you to read the Reference Manual. Your logAggregation method should be like this:

public File logAggregation(List<String> lines) {
     LOGGER.info("Have aggregated messsages. Will archive");
     // Create Files from lines
     return file;
}

它是聚合器的一个主要方法:获取对象列表并返回一个对象.

It is a main method of Aggregator: to get a list of objects and return one object.

这篇关于聚合器末尾的消息不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆