org.springframework.integration.file.FileWritingMessageHandler Java Examples

The following examples show how to use org.springframework.integration.file.FileWritingMessageHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FileWriterIntegrationConfig.java    From spring-in-action-5-samples with Apache License 2.0 5 votes vote down vote up
@Profile("javaconfig")
@Bean
@ServiceActivator(inputChannel="fileWriterChannel")
public FileWritingMessageHandler fileWriter() {
  FileWritingMessageHandler handler =
      new FileWritingMessageHandler(new File("/tmp/sia5/files"));
  handler.setExpectReply(false);
  handler.setFileExistsMode(FileExistsMode.APPEND);
  handler.setAppendNewLine(true);
  return handler;
}
 
Example #2
Source File: FileSinkConfiguration.java    From spring-cloud-stream-app-starters with Apache License 2.0 5 votes vote down vote up
@Bean
@ServiceActivator(inputChannel = Sink.INPUT)
public FileWritingMessageHandler fileWritingMessageHandler(FileNameGenerator fileNameGenerator, FileSinkProperties properties) {
	FileWritingMessageHandler handler = (properties.getDirectoryExpression() != null)
			? new FileWritingMessageHandler(properties.getDirectoryExpression())
			: new FileWritingMessageHandler(new File(properties.getDirectory()));
	handler.setAutoCreateDirectory(true);
	handler.setAppendNewLine(!properties.isBinary());
	handler.setCharset(properties.getCharset());
	handler.setExpectReply(false);
	handler.setFileExistsMode(properties.getMode());
	handler.setFileNameGenerator(fileNameGenerator);
	return handler;
}
 
Example #3
Source File: FileCopyConfig.java    From tutorials with MIT License 5 votes vote down vote up
@Bean
@ServiceActivator(inputChannel = "fileChannel")
public MessageHandler fileWritingMessageHandler() {
    FileWritingMessageHandler handler = new FileWritingMessageHandler(new File(OUTPUT_DIR));
    handler.setFileExistsMode(FileExistsMode.REPLACE);
    handler.setExpectReply(false);
    return handler;
}
 
Example #4
Source File: JavaDSLFileCopyConfig.java    From tutorials with MIT License 4 votes vote down vote up
@Bean
public MessageHandler targetDirectory() {
    FileWritingMessageHandler handler = new FileWritingMessageHandler(new File(OUTPUT_DIR));
    handler.setExpectReply(false); // end of pipeline, reply not needed
    return handler;
}
 
Example #5
Source File: JavaDSLFileCopyConfig.java    From tutorials with MIT License 4 votes vote down vote up
@Bean
public MessageHandler anotherTargetDirectory() {
    FileWritingMessageHandler handler = new FileWritingMessageHandler(new File(OUTPUT_DIR2));
    handler.setExpectReply(false); // end of pipeline, reply not needed
    return handler;
}