qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Paul <purplegher...@gmail.com>
Subject Re: catch resource exceptions in producer?
Date Mon, 07 Mar 2011 15:09:21 GMT
Gordon,

Thanks for the info. Is there something similar in the client namespace?

Matt

On Mon, Mar 7, 2011 at 3:37 AM, Gordon Sim <gsim@redhat.com> 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
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message