简体   繁体   English

简单的驼峰ftp路由超时

[英]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 seconds main] 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.

相关问题 Apache骆驼-简单的扫描目录和ftp上传 - Apache camel - simple scan directory and ftp upload 从Camel路由强制ActiveMQ上的套接字超时? - Enforce socket timeout on ActiveMQ from Camel route? 超时线程中的骆驼http4路由 - camel http4 route in thread with timeout 向 Camel 路由添加延迟会导致 Atomikos 超时 - Adding delay to Camel route causes an Atomikos timeout Apache camel如何在路由上的FTP组件上应用readLock - Apache camel how to apply readLock on FTP component from route 骆驼路线在ftp完成之前拾取文件 - Camel route picking up file before ftp is complete 在开始路由之前交叉检查骆驼 ftp/sftp 身份验证 - Cross checking camel ftp/sftp authentication before starting route 使用简单的Apache Camel FTP在轮询时选择目录 - Apache Camel FTP using Simple for selecting directories when polling Apache Camel:如果我在路由中具有DB访问权限,然后在FTP生产者端点中具有访问权限,那么如何在Camel中实现事务路由? - Apache Camel: How do I achive a transactional route in Camel if I have a DB access in a route and then an FTP producer endpoint? 测试该文件已被骆驼路由ftp:// host / incoming?move = processed移至“处理过” - Testing that file has been moved to “processed” for route ftp://host/incoming?move=processed in camel
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM