Reputation: 9431
I am using Spring Integration Java DSL v. 1.2.2 and following some examples I try to write a code to poll a folder
return IntegrationFlows
.from(Files.inboundAdapter(new File("/tmp/foo")))
.handle((p, h) -> fileProcessor.process(p))
.get();
This code can not be compiled because
"Cannot resolve method 'from(org.springframework.integration.dsl.
file.FileInboundChannelAdapterSpec)'"
How this can be fixed and how fixed-interval polling can be added?
Upvotes: 0
Views: 818
Reputation: 121542
Not clear what's going on in your IDE, but we have this sample in test-cases:
@Bean
public IntegrationFlow fileToFile() {
return IntegrationFlows.from(Files.inboundAdapter(new File("/tmp/in"))
.autoCreateDirectory(true)
.patternFilter("*.txt"),
e -> e.poller(Pollers.fixedDelay(5000)))
.transform(Transformers.fileToString())
.transform("payload.replaceAll('\r\n', '\n')")
.handle(Files.outboundAdapter("'/tmp/out'")
.autoCreateDirectory(true))
.get();
}
The fixedDelay()
is an answer to your second question about fixed-interval
.
Upvotes: 1