简体   繁体   English

由于(不存在)机上交换,Camel进程不会关闭

[英]Camel process do not shutdown because of (not existing) inflight exchanges

I've a Camel process (that I run from command line) which route is similar to this one: 我有一个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");
 }
}

Note that I'm trashing whatever message after having processed it, being this a pure consumer process. 请注意,在处理完消息后,我正在废弃任何消息,这是一个纯粹的消费者流程。

The process is run by its own. 该过程由其自己运行。 No other process is writing on the queue, the queue is empty. 没有其他进程在队列中写入,队列为空。 However when I try to kill the process the process is not going to die. 然而,当我试图杀死这个过程时,这个过程不会消亡。

From the logs I see the following lines (indented for readability): 从日志中我看到以下行(为了便于阅读而缩进):

[                      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.

And so on with decreasing timeout. 等等,减少超时。 At the end of the timeout I get on the logs: 在超时结束时,我得到了日志:

[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

But the process will not die anyway (even if I try to kill it at this point). 但是这个过程无论如何都不会死(即使我此时试图杀死它)。

I would have expected that after the waiting time all the threads would realise that a shutdown is going on and stop. 我原以为在等待时间之后,所有线程都会意识到关闭正在进行并停止。

I've read the "Graceful Shutdown" document, however I could not find something that explains the behaviour I'm facing. 我已经阅读了“Graceful Shutdown”文档,但是我找不到能解释我所面临行为的东西。

As you can see from logs I'm using the 2.11.1 version of Apache Camel. 正如您从日志中看到的那样,我正在使用Apache Camel的2.11.1版本。

UPDATE: According to Claus Ibsen it might be a problem of the camel-kestrel component. 更新:根据克劳斯易卜生的说法,这可能是骆驼隼组件的问题。 I filed a issue on ASF Jira for Camel: CAMEL-6632 我在骆驼的ASF Jira上提出了一个问题: CAMEL-6632

这是camel-kestrel中的一个错误,并且已经记录了JIRA票据以解决此问题: https//issues.apache.org/jira/browse/CAMEL-6632

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM