【问题标题】:How to set expected reply to false using Spring integration DSL. Error no output-channel or replyChannel header available如何使用 Spring 集成 DSL 将预期回复设置为 false。错误没有可用的输出通道或回复通道标头
【发布时间】:2021-06-29 16:28:27
【问题描述】:

我正在使用 Spring Integration 并正在使用文件。我正在使用提供的 DSL 来处理我的文件。在我的集成流程结束时,我使用 Files.outboundGateway(...) 将结果输出到一个新文件。但是我不断收到以下错误no output-channel or replyChannel header available。根据这篇文章底部的帖子,解决方案是将预期回复设置为 false,但是,我该如何使用 DSL 来做到这一点?

下面显示了我在集成流程的最后一部分中正在执行的操作以写入文件。

.handle(Files.outboundGateway(new File(outputFilePath))
                    .autoCreateDirectory(true)
                    .fileExistsMode(FileExistsMode.APPEND)
                    .appendNewLine(true)
                    .fileNameGenerator(m -> m.getHeaders().getOrDefault("file_name", "outputFile") + "_out.txt")
                    
                    )
            .get();

Spring Integration error "no output-channel or replyChannel header available"

【问题讨论】:

    标签: spring-boot spring-integration spring-integration-dsl


    【解决方案1】:

    考虑使用outboundAdapter() 代替网关,因为您不会处理写入结果,这就是您的流程的结束:

    /**
     * Create a {@link FileWritingMessageHandlerSpec} builder for the one-way {@code FileWritingMessageHandler}.
     * @param destinationDirectory the target directory to write files.
     * @return the {@link FileWritingMessageHandlerSpec} instance.
     */
    public static FileWritingMessageHandlerSpec outboundAdapter(File destinationDirectory) {
    

    【讨论】:

      猜你喜欢
      • 2023-04-02
      • 1970-01-01
      • 1970-01-01
      • 2018-06-12
      • 2022-01-17
      • 1970-01-01
      • 1970-01-01
      • 2014-11-19
      • 2018-04-10
      相关资源
      最近更新 更多