Return-Path: Delivered-To: apmail-qpid-users-archive@www.apache.org Received: (qmail 16818 invoked from network); 7 Mar 2011 15:26:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Mar 2011 15:26:57 -0000 Received: (qmail 49266 invoked by uid 500); 7 Mar 2011 15:26:57 -0000 Delivered-To: apmail-qpid-users-archive@qpid.apache.org Received: (qmail 49241 invoked by uid 500); 7 Mar 2011 15:26:57 -0000 Mailing-List: contact users-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@qpid.apache.org Delivered-To: mailing list users@qpid.apache.org Received: (qmail 49232 invoked by uid 99); 7 Mar 2011 15:26:57 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Mar 2011 15:26:57 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of gsim@redhat.com designates 209.132.183.28 as permitted sender) Received: from [209.132.183.28] (HELO mx1.redhat.com) (209.132.183.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Mar 2011 15:26:50 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p27FQTpC010482 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 7 Mar 2011 10:26:29 -0500 Received: from [10.11.9.48] (vpn-9-48.rdu.redhat.com [10.11.9.48]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p27FQS58017823 for ; Mon, 7 Mar 2011 10:26:28 -0500 Message-ID: <4D74F8BC.2050207@redhat.com> Date: Mon, 07 Mar 2011 15:24:44 +0000 From: Gordon Sim Organization: Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom.,Registered in England and Wales under Company Registration No. 3798903,Directors: Michael Cunningham (USA), Charlie Peters (USA) and David Owens (Ireland) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-2.fc11 Lightning/1.0b1 Thunderbird/3.0.4 MIME-Version: 1.0 To: users@qpid.apache.org Subject: Re: catch resource exceptions in producer? References: <0016e6469b6c9c8263049dc2e2c6@google.com> <4D74A73C.70300@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 On 03/07/2011 03:09 PM, Matt Paul wrote: > Gordon, > > Thanks for the info. Is there something similar in the client namespace? Oops, my apologies! For some reason I ignored the fact that your code example doesn't use the qpid::messaging API... In your code you should get the exception thrown on the session.sync() after the messageTransfer()[1]. You want to remove the session.executionSync() call, that is not necessary and may cause problems. Try changing from 'qpid::framing::ResourceLimitExceededException& rex' to 'const qpid::framing::ResourceLimitExceededException& rex'. [1] Note: you could do sync(session).messageTransfer(...) to make the transfer itself synchronous. > > Matt > > On Mon, Mar 7, 2011 at 3:37 AM, Gordon Sim wrote: > >> On 03/05/2011 09:24 PM, purplegherkin@gmail.com wrote: >> >>> Hi, >>> >>> I'ma relatively new qpid user, and I've run across an issue that I can't >>> >>> quite seem to figure out. we have our broker set to allow up to 51200000 >>> bytes of data (which I know is large), but when testing the actual >>> limit, I'm getting the following printed to stderr in the producer (and >>> it won't catch in a SessionException or any other exception): >>> >> >> The exceptions thrown by the API in the qpid::messaging namespace are >> defined in qpid/messaging/exceptions.h. The exception thrown in this case is >> qpid::messaging::TargetCapacityExceeded. >> >> There is a connection level option - x-reconnect-on-limit-exceeded - that >> controls whether the client library itself tries to handle this and it is >> true by default. To handle it yourself you should set that option to false. >> >> >> 2011-03-05 15:11:45 warning Exception received from broker: >>> resource-limit-exceeded: resource-limit-exceeded: Policy exceeded on >>> msaq.direct, policy: size: max=512000000, current=511998551; count: >>> unlimited; type=reject (qpid/broker/QueuePolicy.cpp:86) [caused by 1 >>> \x00:\x00] >>> >>> Is there any way to catch this error? here's the producer side code: >>> >>> while (retryCount< 10) >>> { >>> Connection conn; >>> try >>> { >>> if ((ip_addr)&& (strlen(ip_addr))) >>> conn.open(ip_addr,port); >>> else >>> conn.open("127.0.0.1",port); >>> Session session = conn.newSession(); >>> session.sync(); >>> >>> // create message >>> Message m; >>> m.getDeliveryProperties().setRoutingKey(MSAQ_ROUTING_KEY); >>> m.getDeliveryProperties().setDeliveryMode(DELIVERY_MODE_PERSISTENT); >>> m.setData(msgXml); >>> >>> // set the message id >>> session.messageTransfer(arg::content=m, arg::destination=exchange); >>> session.sync(); >>> session.executionSync(true); >>> conn.close(); >>> break; >>> } >>> catch (const qpid::framing::NotFoundException&) >>> { >>> ++retryCount; >>> pthread_sleep(5); >>> continue; >>> } >>> catch (qpid::framing::ResourceLimitExceededException&rex) >>> { >>> std::string error = rex.what(); >>> conn.close(); >>> TRACE(TRACE_ERROR,(void *) "Error: %s", error.c_str()); >>> LEAVE; >>> return -1; >>> } >>> catch (qpid::SessionException&sex) >>> { >>> std::string error = sex.what(); >>> conn.close(); >>> TRACE(TRACE_ERROR,(void *) "Error: %s", error.c_str()); >>> LEAVE; >>> return -1; >>> } >>> catch (const std::exception&ex) >>> { >>> std::string error = ex.what(); >>> conn.close(); >>> TRACE(TRACE_ERROR,(void *) "Error: %s", error.c_str()); >>> LEAVE; >>> return -1; >>> } >>> >>> Any help at all would really be appreciated and thanks in advance, >>> >>> Matt Paul >>> >>> >> >> --------------------------------------------------------------------- >> Apache Qpid - AMQP Messaging Implementation >> Project: http://qpid.apache.org >> Use/Interact: mailto:users-subscribe@qpid.apache.org >> >> > --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:users-subscribe@qpid.apache.org