Search code examples
apache-camelcamel-ftp

Configuring ftp endpoints in java - how to set "delay"


I have some problems to migrate xml-based camel routes to java. Running the context and routes (i am using Guice) isn't the problem. But until now i am configuring most of the endpoints via uri parameters (not in java).

To be able to reuse the code easily and let the compiler help me (spelling and type of parameters) i want to configure all stuff via setters. (I don't want to fiddle around with string(constants) and concatenate them to uris)

For some endpoints the manual is sufficient. But in case of ftp not all parameters seem to be exposed via "FtpEndpoint". For examples "stepwise" could be set via getConfiguration().setStepwise(stepwise);. So some parameters are set via the endpoint and some via FtpConfiguration.

But in this special case i don't find a method to set "delay". so how to set this?

Is there a general/ unified approach to configure endpoints in java or is this different in each component?


Solution

  • The property delay is from the FileConsumer component and is set via URI parameters with consumer.delay (all FTPConsumer properties must be prefixed with consumer.).

    These properties can not be set in FtpEndpoint or FtpConfiguration but via getConsumerProperties():

    endpoint.getConsumerProperties().put("delay", "500");