Elwin
Elwin

Reputation: 19

How to set expected reply to false using Spring integration DSL. Error no output-channel or replyChannel header available

Im working with Spring Integration and am working with files. I'm using the provided DSL to process my files. At the end of my integration flow I am outputting the result to a new file using Files.outboundGateway(...) . However I keep getting the following error no output-channel or replyChannel header available. According to the post at the bottom of this post the solution is to set the expected reply to false but, how do I do that with the DSL?

Below shows what I'm doing in the last part of my integration flow to write to a file.

.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"

Upvotes: 0

Views: 276

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121282

Consider using an outboundAdapter() instead of gateway since you are not going to deal with the writing result and this is the end of your flow:

/**
 * 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) {

Upvotes: 1

Related Questions