Return-Path: X-Original-To: apmail-activemq-users-archive@www.apache.org Delivered-To: apmail-activemq-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E8BD9D278 for ; Fri, 6 Jul 2012 22:56:58 +0000 (UTC) Received: (qmail 85760 invoked by uid 500); 6 Jul 2012 22:56:58 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 85734 invoked by uid 500); 6 Jul 2012 22:56:58 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 85726 invoked by uid 99); 6 Jul 2012 22:56:58 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Jul 2012 22:56:58 +0000 X-ASF-Spam-Status: No, hits=2.3 required=5.0 tests=SPF_SOFTFAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: softfail (athena.apache.org: transitioning domain of jrr@cisco.com does not designate 216.139.250.139 as permitted sender) Received: from [216.139.250.139] (HELO joe.nabble.com) (216.139.250.139) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Jul 2012 22:56:53 +0000 Received: from [192.168.236.139] (helo=joe.nabble.com) by joe.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1SnHRv-0002IS-HT for users@activemq.apache.org; Fri, 06 Jul 2012 15:56:31 -0700 Date: Fri, 6 Jul 2012 15:56:31 -0700 (PDT) From: JRR To: users@activemq.apache.org Message-ID: <1341615391529-4653781.post@n4.nabble.com> Subject: ActiveMQ-CPP Producer Flow Control Question MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hello, I'm having problems with Producer Flow Control. I have a C++ producer that interacts with a Java application and we are using AMQ to communicate between the two. The AMQ Broker is managed by our Java team, and I've been working with the C++ producer client. The java team recently changed the broker's configuration so that it won't consume all available disk space. They've added the following lines to the activemq.xml configuration file. --------------------------------------------------------------------------- --------------------------------------------------------------------------- After this change we had some long running tests where the consumer was taken off line while the C++ producer was continuing to send messages. Eventually the C++ producer locked up (was flow controlled). I used GDB to attach to the producer process and found the producer was blocked on mutexs, etc. deep in the bowels of the 3rd party activemq-cpp code. I googled sendFailIfNoSpace and landed on the Producer Flow Control page at http://activemq.apache.org/producer-flow-control.html http://activemq.apache.org/producer-flow-control.html I've read through this several times, and that's where I learned the overall name of this "lockup up", and that it's actually expected behavior. What we want is for the broker to limit its disk usage as specified above. And if it reaches the limit the producer gets informed of this, so it can note the fact that the broker is full -- but doesn't lock up. In reading the producer-flow-control.html page it appears that this is possible if we configure client side exceptions -- which the broker does using sendFailIfNoSpace. However, the second half of this appears to be making the client catch the javax.jms.ResourceAllocationException. This is were I get lost. This appears to be java code -- which won't work for me as I am C++ based. How do I handle this exception? I suspect they don't mean simply adding try/catch logic because I would have then expected my C++ producer to crash with an unhandled exception. I'm assuming that I can do this with the C++ API. How would I do this? We are using: AMQ Broker 5.5.0 activemq-cpp 3.4.0 We are using: 1. queues, 2. they are not durable, 3. the messages are not persistent, and 4. we use openwire. The high level flow for the producer client's AMQ exchange is based upon the Producer from the CMS API Overview Page (http://activemq.apache.org/cms/cms-api-overview.html) o. Initialize the Active MQ CPP library (once for the process) o. Create a connection factory using just the broker URI (tcp://localhost:61616) o. Create a connection from the factory. o. Start the connection o. Create a session from the connection using the ack mode of auto acknowledge. o. Create a destination queue using the session o. Create a producer using the destination. o. Change the producer's delivery mode to NON_PERSISTENT o. Create the message to send using the session o. Use the producer to send the message. We have multiple threads sending in the producer. They all use the same underlying connection, and create sessions on top of the connection for sending their messages. Thanks in advance for your help, -=John -- View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-CPP-Producer-Flow-Control-Question-tp4653781.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.