Search in sources :

Example 16 with FileWritingMessageHandler

use of org.springframework.integration.file.FileWritingMessageHandler in project tutorials by eugenp.

the class FileCopyConfig method fileWritingMessageHandler.

@Bean
@ServiceActivator(inputChannel = "fileChannel")
public MessageHandler fileWritingMessageHandler() {
    FileWritingMessageHandler handler = new FileWritingMessageHandler(new File(OUTPUT_DIR));
    handler.setFileExistsMode(FileExistsMode.REPLACE);
    handler.setExpectReply(false);
    return handler;
}
Also used : FileWritingMessageHandler(org.springframework.integration.file.FileWritingMessageHandler) File(java.io.File) ServiceActivator(org.springframework.integration.annotation.ServiceActivator) Bean(org.springframework.context.annotation.Bean)

Example 17 with FileWritingMessageHandler

use of org.springframework.integration.file.FileWritingMessageHandler in project spring-boot by spring-projects.

the class SampleIntegrationApplication method fileWriter.

@Bean
public FileWritingMessageHandler fileWriter() {
    FileWritingMessageHandler writer = new FileWritingMessageHandler(this.serviceProperties.getOutputDir());
    writer.setExpectReply(false);
    return writer;
}
Also used : FileWritingMessageHandler(org.springframework.integration.file.FileWritingMessageHandler) Bean(org.springframework.context.annotation.Bean)

Aggregations

FileWritingMessageHandler (org.springframework.integration.file.FileWritingMessageHandler)17 Test (org.junit.Test)13 DirectFieldAccessor (org.springframework.beans.DirectFieldAccessor)11 File (java.io.File)8 Expression (org.springframework.expression.Expression)4 Bean (org.springframework.context.annotation.Bean)3 DefaultFileNameGenerator (org.springframework.integration.file.DefaultFileNameGenerator)2 Method (java.lang.reflect.Method)1 ServiceActivator (org.springframework.integration.annotation.ServiceActivator)1