{
if (wi instanceof EventReceivedWorkItem)
{
EventReceivedWorkItem item = (EventReceivedWorkItem)wi;
Agent agent = item.getAgent();
QmfEvent event = item.getEvent();
String className = event.getSchemaClassId().getClassName();
if (className.equals("queueDeclare"))
{
updateQueueCache();
}
else if (className.equals("queueThresholdExceeded"))
{
String queueName = event.getStringValue("qName");
boolean matches = false;
for (Pattern x : _filter)
{ // Check the queue name against the regexes in the filter List (if any)
Matcher m = x.matcher(queueName);
if (m.find())
{
matches = true;
break;
}
}
if (_filter.isEmpty() || matches)
{ // If there's no filter enabled or the filter matches the queue name we call purgeQueue().
long msgDepth = event.getLongValue("msgDepth");
purgeQueue(queueName, msgDepth);
}
}
}
}