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 EDBD718FBA for ; Tue, 9 Feb 2016 08:22:18 +0000 (UTC) Received: (qmail 39402 invoked by uid 500); 9 Feb 2016 08:22:18 -0000 Delivered-To: apmail-camel-issues-archive@camel.apache.org Received: (qmail 39267 invoked by uid 500); 9 Feb 2016 08:22:18 -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 39063 invoked by uid 99); 9 Feb 2016 08:22:18 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Feb 2016 08:22:18 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 2076A2C1F5D for ; Tue, 9 Feb 2016 08:22:18 +0000 (UTC) Date: Tue, 9 Feb 2016 08:22:18 +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= 8518#comment-15138518 ]=20 Claus Ibsen commented on CAMEL-9567: ------------------------------------ We just released 2.16.2, so would take a month or so for the next. But mayb= e 2.15.x is released sooner. You can always build a local JAR with the patch and use that until there is= a release. > 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 > Fix For: 2.15.6, 2.16.3, 2.17.0 > > > 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)