You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by brianlmartino <br...@yahoo.com> on 2014/12/02 16:43:02 UTC
Why doesn't camel throw an error for invalid file or invalid ftp?
What is wrong with my code? I have tried two ways to get this to fail with
errors. I am expecting camel to have a problem connecting to the bogus ftp
site and not finding the file in question.
====== Using CamelContext and main method =======
import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
public class FtpCamelContext extends RouteBuilder {
@Override
public void configure() throws Exception {
from("file://NoSuchFile.txt").
to("ftp://ftp.NoSuchDomain.com");
}
public static void main (String[] args) throws Exception {
CamelContext camelContext = new DefaultCamelContext();
camelContext.addRoutes(new FtpCamelContext());
camelContext.start();
}
}
========= Using Camel Main ===============
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.main.Main;
public class FtpCamelMain extends RouteBuilder {
private FtpCamelMain() {
}
@Override
public void configure() throws Exception {
from("file://NoSuchFile.txt").
to("ftp://ftp.NoSuchDomain.com");
}
public static void main(String[] args) throws Exception {
Main main = new Main();
main.addRouteBuilder(new FtpCamelMain());
main.enableHangupSupport();
main.start();
main.run();
}
Console output from Camel:
[simulators.FtpCamelMain.main()] MainSupport INFO Apache
Camel 2.13.2 starting
[simulators.FtpCamelMain.main()] DefaultCamelContext INFO Apache
Camel 2.13.2 (CamelContext: camel-1) is starting
[simulators.FtpCamelMain.main()] ManagedManagementStrategy INFO JMX is
enabled
[simulators.FtpCamelMain.main()] DefaultTypeConverter INFO Loaded
178 type converters
[simulators.FtpCamelMain.main()] DefaultCamelContext INFO
AllowUseOriginalMessage is enabled. If access to the original message is not
needed, then its recommended to turn this option off as it may improve
performance.
[simulators.FtpCamelMain.main()] DefaultCamelContext INFO
StreamCaching is not in use. If using streams then its recommended to enable
stream caching. See more details at
http://camel.apache.org/stream-caching.html
[simulators.FtpCamelMain.main()] FtpEndpoint DEBUG
Created FTPClient [connectTimeout: 10000, soTimeout: 0, dataTimeout: 30000]:
org.apache.commons.net.ftp.FTPClient@292f062b
[simulators.FtpCamelMain.main()] RemoteFileProducer DEBUG
Starting
[simulators.FtpCamelMain.main()] RemoteFileProducer TRACE
Starting producer: RemoteFileProducer[ftp://ftp.NoSuchDomain.com]
[simulators.FtpCamelMain.main()] DefaultCamelContext INFO Route:
route1 started and consuming from: Endpoint[file://NoSuchFile.txt]
[simulators.FtpCamelMain.main()] DefaultCamelContext INFO Total
1 routes, of which 1 is started.
[simulators.FtpCamelMain.main()] DefaultCamelContext INFO Apache
Camel 2.13.2 (CamelContext: camel-1) started in 0.843 seconds
--
View this message in context: http://camel.465427.n5.nabble.com/Why-doesn-t-camel-throw-an-error-for-invalid-file-or-invalid-ftp-tp5759957.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Why doesn't camel throw an error for invalid file or invalid
ftp?
Posted by brianlmartino <br...@yahoo.com>.
Using camel 2.0 , passing just a single file needs special syntax. Camel
will ignore the route if the file isn't found.
@Override
public void configure() throws Exception {
from("file:.?fileName=pom.xml").
to("ftp://noone@nowhere:22/wth?password=test");
}
This post is now closed.
--
View this message in context: http://camel.465427.n5.nabble.com/Why-doesn-t-camel-throw-an-error-for-invalid-file-or-invalid-ftp-tp5759957p5759963.html
Sent from the Camel - Users mailing list archive at Nabble.com.