qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplegher...@gmail.com
Subject catch resource exceptions in producer?
Date Sat, 05 Mar 2011 21:24:17 GMT
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):

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

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