2017-06-13 8 views
0

を追加するとき、私は春の統合のJava DSL vを使用していますエラーをコンパイル1.2.2と私はフォルダのJava DSLを使用して、ファイルからのポーリング - Files.inboundAdapter

return IntegrationFlows 
      .from(Files.inboundAdapter(new File("/tmp/foo"))) 
      .handle((p, h) -> fileProcessor.process(p)) 
      .get(); 

をポーリングするコードを記述しようとするいくつかの例を以下に示します。

"Cannot resolve method 'from(org.springframework.integration.dsl. 
    file.FileInboundChannelAdapterSpec)'" 

これはどのように修正でき、どのように固定間隔ポーリングを追加できるのですか?

答えて

1

あなたのIDEで何が起こっているクリアし、私たちは、テスト・ケースで、このサンプルを持っていない:

@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(); 
} 

fixedDelay()fixed-intervalについてのあなたの2番目の質問への答えです。

https://github.com/spring-projects/spring-integration-java-dsl/blob/master/src/test/java/org/springframework/integration/dsl/samples/file2file1/FileChangeLineSeparator.java

+0

アルテム、あなたは私が使用すべきかを明確にしてください依存することができますか?私は今、コンパイル( "org.springframework.boot:spring-boot-starter-integration:1.5.4.RELEASE")を使用しなければなりませんでしたし、直接typecatsを使用しなければなりませんでした。IntegrationFlows.from((MessageSourceSpec > )Files.inboundAdapter(ディレクトリ) - まだリンク中エラーが発生しましたnowError:(105、38)java:org.springframework.integration.file.FileReadingMessageSourceにアクセスできない –

+0

DSLサポートを追加する場合、これは、DSLを含まないcompile( "org.springframework.integration:spring-integration-core:4.3.10.RELEASE")を追加することを示唆しています –

+0

'Spring-Integration-file'を追加する必要があります。 Spring統合では、独立したjar、依存関係アーティファクト –

関連する問題