camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Context scoped onCompletion() not closing RabbitMQ connection
Date Sun, 12 Jun 2016 07:55:17 GMT
Hi

What version of Camel are you using?

On Sat, Jun 11, 2016 at 5:21 PM, Darrell King <kingdarrella@gmail.com> wrote:
> Hi,
> I have a context scoped onCompletion() that sends to RabbitMQ. When Camel
> is shutdown it doesn't close the connection to RabbitMQ. If the
> onCompletion() is route scoped the connection is closed.
>
> This test shows the problem. I expect the SendProcessor to be shutdown when
> the CamelContext is shutdown but it's state is started=true. Am I doing
> something wrong ?
>
> public class RabbitMQProducerOnCompletionShutdownIntTest extends
> CamelTestSupport {
>     private static final String EXCHANGE = "ex1";
>     private static final String COMPLETION_URI =
> String.format("rabbitmq:localhost:5672/%s?routingKey=%s&username=cameltest&password=cameltest&skipQueueDeclare=true",
> EXCHANGE, "routeCompletion");
>
>     @Produce(uri = "direct:start")
>     protected ProducerTemplate template;
>
>     @Override
>     protected RouteBuilder createRouteBuilder() throws Exception {
>         return new RouteBuilder() {
>             @Override
>             public void configure() throws Exception {
>                 onCompletion().to(COMPLETION_URI);
>                 from("direct:start").to("direct:end");
>             }
>         };
>     }
>
>     @Test
>     public void contextScopedOnCompletionProcessorShouldBeShutdown()
> throws Exception {
>         OnCompletionProcessor p1 = (OnCompletionProcessor)
> context().getProcessor("onCompletion1");
>         context().stop();
>         // Expect that the sendProcessor with id="to1"
> (p1.processor.processor.nextProcessor) is shutdown:
>         // but is is not
>     }
> }



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Mime
View raw message