Return-Path: X-Original-To: apmail-camel-issues-archive@minotaur.apache.org Delivered-To: apmail-camel-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C9C48187D9 for ; Mon, 8 Feb 2016 17:53:40 +0000 (UTC) Received: (qmail 8918 invoked by uid 500); 8 Feb 2016 17:53:40 -0000 Delivered-To: apmail-camel-issues-archive@camel.apache.org Received: (qmail 8822 invoked by uid 500); 8 Feb 2016 17:53:40 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 8687 invoked by uid 99); 8 Feb 2016 17:53:40 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Feb 2016 17:53:40 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 035FE2C1F70 for ; Mon, 8 Feb 2016 17:53:40 +0000 (UTC) Date: Mon, 8 Feb 2016 17:53:40 +0000 (UTC) From: "Claus Ibsen (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CAMEL-9567) SjmsConsumer does not suspend (on Camel context) stop MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CAMEL-9567?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1513= 7341#comment-15137341 ]=20 Claus Ibsen commented on CAMEL-9567: ------------------------------------ I made a fix for 2.16 and 2.15 https://github.com/apache/camel/commit/88dd249fe0aae965d7c9736e0911082f62ef= ed16 >From 2.17 onwards its fixed by that other CAMEL-9577 ticket. > SjmsConsumer does not suspend (on Camel context) stop > ----------------------------------------------------- > > Key: CAMEL-9567 > URL: https://issues.apache.org/jira/browse/CAMEL-9567 > Project: Camel > Issue Type: Bug > Components: camel-sjms > Affects Versions: 2.16.2 > Reporter: Zden=C4=9Bk Obst > Labels: camel-sjms > > When using SjmsConsumer that consumes JMS messages from broker (e.g. Acti= veMQ) and *stop Camel Context, the consumer still reads new messages from b= roker* even if it should only finish processing of already fetched messages= . It causes that Context is never stopped if there are still new and new me= ssages in the broker (or before timeout for stop operation occurs). > When I investigated code, it seems that suspend operation is not implemen= ted (or code does not check isSuspended flag). What I would expect is that = consumer unregisters JMS listener on context stop (consumer suspend). > Here is the sample code I used for testing: > {code:java} > public class Test { > public static void main(String[] args) throws Exception { > // pre-fill JMS Broker with many many messages, e.g. 10.000 > RouteBuilder rb =3D new RouteBuilder() { > @Override > public void configure() throws Exception { > from("sjms:queue:test?consumerCount=3D5") > .process(new Processor() { > @Override > public void process(Exchange exchange) throws= Exception { > Thread.sleep(1000); // not to consume all= messages instantly > System.out.println("Processed message " += exchange.getExchangeId()); > } > }); > } > }; > CamelContext context =3D new DefaultCamelContext(); > context.getShutdownStrategy().setTimeout(1000); // 1000s =3D big = enough timeout so I can be sure it is consumer problem > addJmsComponent(context); > context.addRoutes(rb); > System.out.println("=3D=3D=3D=3D=3D> Starting context"); > context.start(); > Thread.sleep(5 * 1000); // Consume few messages at the beginning > System.out.println("=3D=3D=3D=3D=3D> Stopping context"); > context.stop(); > System.out.println("=3D=3D=3D=3D=3D> Context stopped"); // Will n= ot get here as long as there are any messages left in the queue > } > private static void addJmsComponent(CamelContext context) { > ConnectionFactory factory =3D new ActiveMQConnectionFactory("tcp:= //localhost:61616"); // ActiveMQ is easiest for testing this > ConnectionFactoryResource connResource =3D new ConnectionFactoryR= esource(5, factory); > SjmsComponent comp =3D new SjmsComponent(); > comp.setConnectionResource(connResource); > context.addComponent("sjms", comp); > } > } > {code} > The original mailing list thread: > http://camel.465427.n5.nabble.com/CamelContext-stop-with-SJMS-consumer-do= es-not-stop-consuming-messages-from-broker-td5777207.html -- This message was sent by Atlassian JIRA (v6.3.4#6332)