我正在开发一个基于驼峰的简单应用程序。它从sftp位置读取一些文件,然后将其放到aws-s3位置。问题是在将文件放入s3之后,我调用了camel context的stop方法。但是在控制台上打印“关闭mydatabucket.s3.amazonaws.com/51.321.68.342:453 com.amazonaws.internal.SdkSSLSocket ”的输出后,代码卡在那里,没有任何进一步发生。这是非常意外的,因为稍后我将不得不处理由camel放置的s3中的文件。但是,如果没有更多的文件可以从sftp中选择,那么驼峰上下文就不会停止,那么这是不可能的。那么骆驼语境的停止方法是如何起作用的,因为在我的情况下它显然不起作用或者说让我们永远服用。
我的routebuilder代码如下
from(this.feedSource).routeId(this.routeId).setProperty("feedName", simple(this.feedName))
.setProperty("options", simple(this.options))
.setProperty("prefixKey", simple(this.prefixKey))
.setProperty("dateFormat", simple(this.dateFormat))
.setProperty("verifyFileSize", simple("true"))
.filter().method(new FileFilter(), "process")
.split(beanExpression(new FileProcessorFactory(), "getProcessor")).parallelProcessing()
.filter().method(new FeedRouteFileFilter(), "isFileAlreadyProcessed")
.id(simple(this.feedName)
.to(this.feedDestination).id(simple(this.feedName)
.stop();
我通过从实际启动路径的其他文件执行 main.run()来启动camel的主要上下文。