2

Can't find an example anywhere using spring integration DSL only xml. Any pointers appreciated, also need the poller to trigger on file creation and modification

Ant
  • 69
  • 1
  • 11

1 Answers1

2

How bout this one:

@Bean
public IntegrationFlow fileReadingFlow() {
    return IntegrationFlows
            .from(s -> s.file(tmpDir.getRoot()).patternFilter("*.sitest"),
                    e -> e.poller(Pollers.fixedDelay(100)))
            .transform(Transformers.fileToString())
            .channel(MessageChannels.queue("fileReadingResultChannel"))
            .get();
}

? The .from() factory method accepts here a MessageSources factory, from where you are using .file() factory method and so on.

More information is in the projects tests: https://github.com/spring-projects/spring-integration-java-dsl/tree/master/src/test/java/org/springframework/integration/dsl/test

Artem Bilan
  • 113,505
  • 11
  • 91
  • 118
  • Thanks Artem but will this poller trigger on file creation / modification? My orig. sol. was using the Java nio lib to achieve this. – Ant Jul 09 '15 at 09:14