[英]Simple camel ftp route timeout
I configured a simple route inside a test class see below: 我在测试类中配置了一个简单的路由,见下图:
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
public class TestClass extends CamelTestSupport {
String ftpSourceUri = "ftp://some.server.com:21?username=user&password=secret&fileName=test.csv";
@Test
public void testRouteConsumesTestFileFromFTPEndpoint() throws Exception{
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMinimumMessageCount(1);
assertMockEndpointsSatisfied();
}
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
from(ftpSourceUri)
.multicast().to("mock:result","stream:out");
}
};
}
}
I have validated the authentication details and the file location via FileZilla. 我已经通过FileZilla验证了身份验证详细信息和文件位置。
This is the trace snippet produced by camel when I execute the above code:
这是我执行上面代码时由camel生成的跟踪片段:
[ main] DefaultCamelContext INFO Apache Camel 2.14.0 (CamelContext: camel-1) is starting [
[main] DefaultCamelContext INFO Apache Camel 2.14.0(CamelContext:camel-1)正在启动[
main] DefaultManagementStrategy INFO JMX is disabled [main] DefaultManagementStrategy INFO JMX被禁用[
main] DefaultTypeConverter INFO Loaded 192 type converters [ main] DefaultCamelContext INFO AllowUseOriginalMessage is enabled.main] DefaultTypeConverter INFO已加载192类型转换器[main] DefaultCamelContext INFO AllowUseOriginalMessage已启用。 If access to the original message is not needed, then its recommended to turn this option off as it may improve performance.
如果不需要访问原始邮件,则建议关闭此选项,因为它可能会提高性能。 [ main] DefaultCamelContext INFO StreamCaching is not in use.
[main] DefaultCamelContext INFO StreamCaching未使用。 If using streams then its recommended to enable stream caching.
如果使用流,则建议启用流缓存。 See more details at [ main] DefaultCamelContext
在[main] DefaultCamelContext中查看更多详细信息
INFO Route: route1 started and consuming from: Endpoint['endpoint url'] <-- I can't post more than 2 links apparently [INFO路由:route1启动并消耗:Endpoint ['endpoint url'] < - 我显然不能发布超过2个链接[
main] DefaultCamelContext INFO Total 1 routes, of which 1 is started.main] DefaultCamelContext INFO总共1条路线,其中1条路线已启动。 [ main] DefaultCamelContext
[main] DefaultCamelContext
INFO Apache Camel 2.14.0 (CamelContext: camel-1) started in 0.140 seconds [ main] MockEndpoint信息Apache Camel 2.14.0(CamelContext:camel-1)在0.140秒内开始[主要] MockEndpoint
INFO Asserting: Endpoint[mock://result] is satisfied [tal-music-ftp.amazonmp3.com:21] FtpConsumer INFO Connected and logged in to: ['endpoint url'] <-- I can't post more than 2 links apparently [ main] AmazonMP3SimpleFTPRouteTest INFO ******************************************************************************** [ main] AmazonMP3SimpleFTPRouteTest INFO Testing done: testRouteConsumesTestFileFromFTPEndpoint(com.test.camel.SimpleFTPRouteTest) [ main] AmazonMP3SimpleFTPRouteTest INFO Took: 10.010 seconds (10010 millis) [ main] AmazonMP3SimpleFTPRouteTest INFO ******************************************************************************** [ main] DefaultCamelContext INFO Apache Camel 2.14.0 (CamelContext: camel-1) is shutting down [信息断言:端点[mock:// result]得到满足[tal-music-ftp.amazonmp3.com:21] FtpConsumer INFO已连接并登录到:['端点url'] < - 我发布的信息不能超过2个链接显然[主要] AmazonMP3SimpleFTPRouteTest INFO ****************************************** ************************************** [main] AmazonMP3SimpleFTPRouteTest INFO测试完成:testRouteConsumesTestFileFromFTPEndpoint(com。 test.camel.SimpleFTPRouteTest)[main] AmazonMP3SimpleFTPRouteTest INFO Took:10.010秒(10010毫秒)[main] AmazonMP3SimpleFTPRouteTest INFO ************************** ************************************************** **** [main] DefaultCamelContext INFO Apache Camel 2.14.0(CamelContext:camel-1)正在关闭[
main] DefaultShutdownStrategy INFO Starting to graceful shutdown 1 routes (timeout 10 seconds) [el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy INFO Waiting as there are still 1 inflight and pending exchanges to complete, timeout in 10 seconds.main] DefaultShutdownStrategy INFO开始正常关闭1个路由(超时10秒)[el-1]线程#1 - ShutdownTask] DefaultShutdownStrategy INFO等待,因为仍有1个飞行和待处理交换完成,10秒内超时。 [el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy
[el-1] thread#1 - ShutdownTask] DefaultShutdownStrategy
INFO Waiting as there are still 1 inflight and pending exchanges to complete, timeout in 9 seconds.INFO等待,因为仍有1个空中和待定交换完成,9秒内超时。 [el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy INFO Waiting as there are still 1 inflight and pending exchanges to complete, timeout in 8 seconds.
[el-1] thread#1 - ShutdownTask] DefaultShutdownStrategy INFO等待,因为仍有1个飞行和待定交换完成,8秒内超时。 [el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy INFO Waiting as there are still 1 inflight and pending exchanges to complete, timeout in 7 seconds.
[el-1]线程#1 - ShutdownTask] DefaultShutdownStrategy INFO等待,因为仍有1个飞行和待定交换完成,7秒内超时。 [el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy INFO Waiting as there are still 1 inflight and pending exchanges to complete, timeout in 6 seconds.
[el-1]线程#1 - ShutdownTask] DefaultShutdownStrategy INFO等待,因为仍有1个飞行和待定交换完成,6秒内超时。 [el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy INFO Waiting as there are still 1 inflight and pending exchanges to complete, timeout in 5 seconds.
[el-1] thread#1 - ShutdownTask] DefaultShutdownStrategy INFO等待仍然有1个飞行和待定交换完成,5秒内超时。 [el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy INFO Waiting as there are still 1 inflight and pending exchanges to complete, timeout in 4 seconds.
[el-1]线程#1 - ShutdownTask] DefaultShutdownStrategy INFO等待,因为仍有1个空中和待定交换完成,4秒内超时。 [el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy INFO Waiting as there are still 1 inflight and pending exchanges to complete, timeout in 3 seconds.
[el-1] thread#1 - ShutdownTask] DefaultShutdownStrategy INFO等待,因为仍有1个飞行和待定交换完成,3秒内超时。 [el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy INFO Waiting as there are still 1 inflight and pending exchanges to complete, timeout in 2 seconds.
[el-1] thread#1 - ShutdownTask] DefaultShutdownStrategy INFO等待,因为仍有1个飞行和待处理的交换完成,2秒内超时。 [el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy INFO Waiting as there are still 1 inflight and pending exchanges to complete, timeout in 1 seconds.
[el-1] thread#1 - ShutdownTask] DefaultShutdownStrategy INFO等待,因为仍有1个飞行和待处理交换完成,1秒内超时。 [ main] DefaultShutdownStrategy WARN Timeout occurred.
[main] DefaultShutdownStrategy WARN超时发生。 Forcing the routes to be shutdown now.
强制现在关闭路由。 Some resources may still be running.
某些资源可能仍在运行。 [el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy WARN Interrupted while waiting during graceful shutdown, will force shutdown now.
[el-1] thread#1 - ShutdownTask] DefaultShutdownStrategy WARN在正常关闭期间等待时中断,将立即强制关闭。 [el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy INFO Route: route1 shutdown complete, was consuming from: Endpoint['endpoint url'] <-- I can't post more than 2 links apparently [ main] DefaultShutdownStrategy INFO Graceful shutdown of 1 routes completed in 52 seconds [
[el-1]线程#1 - ShutdownTask] DefaultShutdownStrategy INFO路由:route1 shutdown完成,消耗来自:Endpoint ['endpoint url'] < - 我显然不能发布超过2个链接[main] DefaultShutdownStrategy INFO正常关闭在52秒内完成1条路线[
main] DefaultCamelContext INFO Apache Camel 2.14.0 (CamelContext: camel-1) uptime 1 minute [main] DefaultCamelContext INFO Apache Camel 2.14.0(CamelContext:camel-1)正常运行时间1分钟[
main] DefaultCamelContext INFO Apache Camel 2.14.0 (CamelContext: camel-1) is shutdown in 52.486 secondsmain] DefaultCamelContext INFO Apache Camel 2.14.0(CamelContext:camel-1)在52.486秒内关闭
What can I do to simply download the file? 我该怎么做才能简单地下载文件?
The MockEndpoint will by default timeout after 10 seconds from unit testing. 默认情况下,MockEndpoint将在单元测试10秒后超时。 So you need to set a higher wait time for the FTP to download and process the file.
因此,您需要为FTP下载和处理文件设置更长的等待时间。
You can pass in a timeout value in, for example 例如,您可以传入超时值
assertMockEndpointsSatisfied(5, TimeUnit.MINUTES);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.