Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/425.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring integration 当我们使用入站通道适配器时,如何指定输出通道或执行顺序_Spring Integration - Fatal编程技术网

Spring integration 当我们使用入站通道适配器时,如何指定输出通道或执行顺序

Spring integration 当我们使用入站通道适配器时,如何指定输出通道或执行顺序,spring-integration,Spring Integration,我使用SpringIntegration下载文件并处理它们 <int-sftp:inbound-channel-adapter channel="FileDownloadChannel" session-factory="SftpSessionFactory" remote-directory="/home/sshaji/from_disney/files"

我使用SpringIntegration下载文件并处理它们

<int-sftp:inbound-channel-adapter channel="FileDownloadChannel"
                      session-factory="SftpSessionFactory"
                      remote-directory="/home/sshaji/from_disney/files"
                      filter = "modifiedFileListFilter"
                      local-directory="/home/sshaji/to_disney/downloads" 
                      auto-create-local-directory="true" >                       
       <integration:poller cron="*/10 * * * * *" default="true"/>   
</int-sftp:inbound-channel-adapter>

 <integration:transformer  input-channel="FileDownloadChannel"
                            ref="ErrorTransformer"
                            output-channel="EndChannel"/>
执行由轮询器启动。 它调用FileDownloadChannel,然后尝试从sftp服务器下载文件。 我想为此入站通道适配器指定一个输出通道,但它没有任何输出通道属性

因此,我用与入站通道适配器相同的名称命名了转换器,这样一旦轮询器启动,它也将被调用

我的问题是,transformer在下载之前被调用,因此transformer不会得到任何要处理的输入,并导致错误

有没有办法为这两个任务指定order属性。或者对于入站通道适配器的输出通道是否有任何解决方法

如果您能在这方面提供帮助,我将不胜感激。

您需要阅读并完成一些

通道适配器没有输入和输出通道,它们有通道。通道适配器在其通道上生成或使用入站消息和出站消息。接收消息并生成回复的元素(如转换器、服务激活器等)具有输入和输出通道

我的问题是,transformer在下载之前被调用,因此transformer不会得到任何要处理的输入,并导致错误

这句话对我来说毫无意义;如果还没有文件,就没有什么可以调用transformer的

这两个任务的属性

没有两项任务


轮询器线程调用入站适配器;然后,当文件到达时,它将作为消息发送到已配置的通道,根据您的配置,这意味着轮询器线程使用消息调用转换器。

通道适配器是一个消息端点,允许将单个发送者或接收者连接到消息通道

在您的情况下,输出通道是“FileDownloadChannel”

为了按顺序执行任务,您可以使用消息处理程序链,如下所示:

<integration:channel id="outputChannel"/>
<chain input-channel="FileDownloadChannel" output-channel="outputChannel">
    <filter ref="someSelector" throw-exception-on-rejection="true"/>
    <transformer ref="ErrorTransformer"/>
    <service-activator ref="someService" method="someMethod"/>
</chain>

@GaryRussell你能给我一些建议吗?
<integration:channel id="outputChannel"/>
<chain input-channel="FileDownloadChannel" output-channel="outputChannel">
    <filter ref="someSelector" throw-exception-on-rejection="true"/>
    <transformer ref="ErrorTransformer"/>
    <service-activator ref="someService" method="someMethod"/>
</chain>