qie.getErrorCount¶
Signature: qie.getErrorCount()
Returns: Integer errorCount - the number of messages in the error queue
Returns the current number of messages in the error queue.
Parameters¶
None
Example¶
/* From a Scheduled Script, every hour see if we can resolve errors */
if (qie.getErrorCount() > 0) {
var messagesResolved = 0;
var results = errorManager.searchErrors('error=disgracefulWebServiceFailure');
for (var i=0 ; i < results.size() ; i++) {
var messageQueueId = results.get(i);
//Use to get the messages source model. Used to check the source for "Bad Value"s and update with "Good Value"
var errorSource = errorManager.getSource(messageQueueId);
//if there is no parent then this message has not been previously resubmitted or resolved
if (!errorManager.hasParent(messageQueueId)) {
if (errorSource != null) {
if (StringUtils.equals(errorSource.getNode('PID-33.1'), 'Bad Value')) {
//modify the source
errorSource.setNode('PID-33.1', 'Good Value');
errorManager.resolveError(messageQueueId, errorSource);
messagesResolved++;
} else {
qie.debug("This message does not contain 'Bad Value'. Skipping");
}
} else {
qie.debug('This message does not contain a valid source. Skipping');
}
} else {
qie.debug('This message queue was previously resolved. Skipping');
}
}
qie.debug('Finished resolving errors');
qie.queueEmail('rabbit@acme.ltunes.com', 'Auto error resolution summary', 'Resolved ' + messagesResolved + ' errors.');
} else {
qie.debug('No errors found. Nothing to resolve.');
}