Search code examples
apache-camelcamel-ftp

Camel Poll Enrich apparently ignores the Batch Consumer behavior of the ftp component


I'm probrably missing something, but here is what's happening.

This works: I have two files on the todo folder. If I create this route everything works fine, I received the two exchanges, one for each file, every 30 seconds:

    from(String.format(baseFtpConnectionString, "/todo/") + "&scheduler=quartz2&scheduler.cron=0/10+*+*+*+*+?")
    .to("log:test?showAll=true&multiline=true")
    .unmarshal(bindyRegister)
    .process(new Processor() {                  
      @Override
      public void process(Exchange exchange) throws Exception {
          System.out.println("Ok");            
      }
    })
    .end();  

The problem: But, if I create this route, one exchange is received every 30 seconds, switching between the two files.

  from("quartz2://getData?cron=0/10+*+*+*+*+?")
  .pollEnrich(String.format(baseFtpConnectionString, "/todo/"))
  .to("log:test?showAll=true&multiline=true")
  .unmarshal(bindyRegister)
  .process(new Processor() {                  
    @Override
    public void process(Exchange exchange) throws Exception {
        System.out.println("Ok");            
    }
  })
  .end(); 

The ftp url in the baseFtpConnectionString is something like this after the String.format:

ftps://user@path:port/path?password=password&passiveMode=true

Why the pollEnrich do not send me the two exchanges? It was not suppose to have the same behavior as a from statement?

EDIT 1

Is there a way to do that using poolEnrich (Recieve all the exchanges, for both files) ?

EDIT 2

Apparently there is not. So, is there any other way to load all files from a ftp component that began on a direct component, besides the one on the link?


Solution

  • No its not to be the same.

    A poll enrich is only enriching for one message at a time.