我有一个Camel进程(我从命令行运行),该路由与此类似:
public class ProfilerRoute extends RouteBuilder {
@Override
public void configure() {
from("kestrel://my_queue?concurrentConsumers=10&waitTimeMs=500")
.unmarshal().json(JsonLibrary.Jackson, MyClass.class)
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
/* Do the real processing [...] */
exchange.getIn().setBody(null);
}
})
.filter(body().isNotNull())
.to("file://nowhere");
}
}
请注意,在处理完这些消息后,我正在诋毁任何消息,因为这是一个纯粹的消费者 过程
该过程由其自己运行。没有其他进程在队列中写入,队列为空。 然而,当我试图杀死这个过程时,这个过程不会消亡。
从日志中我看到以下行(为了便于阅读而缩进):
[ Thread-1] MainSupport$HangupInterceptor INFO
Received hang up - stopping the main instance.
[ Thread-1] MainSupport INFO
Apache Camel stopping
[ Thread-1] GuiceCamelContext INFO
Apache Camel 2.11.1 (CamelContext: camel-1)
is shutting down
[ Thread-1] DefaultShutdownStrategy INFO
Starting to graceful shutdown 1 routes
(timeout 300 seconds)
[l-1) thread #12 - ShutdownTask] DefaultShutdownStrategy INFO
Waiting as there are still 10 inflight and
pending exchanges to complete,
timeout in 300 seconds.
等等,减少超时。在超时结束时,我得到了日志:
[l-1) thread #12 - ShutdownTask] DefaultShutdownStrategy INFO
Waiting as there are still 10 inflight and
pending exchanges to complete,
timeout in 1 seconds.
[ Thread-1] DefaultShutdownStrategy WARN
Timeout occurred.
Now forcing the routes to be shutdown now.
[l-1) thread #12 - ShutdownTask] DefaultShutdownStrategy WARN
Interrupted while waiting during graceful
shutdown, will force shutdown now.
[ Thread-1] KestrelConsumer INFO
Stopping consumer for
kestrel://localhost:22133/my_queue?concurrentConsumers=10&waitTimeMs=500
但是这个过程无论如何都不会死(即使我此时试图杀死它)。
我原本预计在等待时间之后,所有线程都会意识到关闭正在进行并停止。
我已经阅读了"Graceful Shutdown"文档,但是找不到能解释我所面临行为的内容。
从日志中我可以看到我正在使用Apache Camel的2.11.1版本。
更新:根据克劳斯易卜生的说法,这可能是骆驼隼组件的问题。我在骆驼的ASF Jira上提出了一个问题:CAMEL-6632
答案 0 :(得分:1)
这是camel-kestrel中的一个错误,并且已记录JIRA票证以解决此问题:https://issues.apache.org/jira/browse/CAMEL-6632