{
OperationStatus status = _deliveryDb.delete(tx, key);
if (status == OperationStatus.NOTFOUND)
{
throw new AMQStoreException("Unable to find message with id " + messageId + " on queue "
+ (queue instanceof AMQQueue ? ((AMQQueue) queue).getName() + " with id " : "") + id);
}
else if (status != OperationStatus.SUCCESS)
{
throw new AMQStoreException("Unable to remove message with id " + messageId + " on queue"
+ (queue instanceof AMQQueue ? ((AMQQueue) queue).getName() + " with id " : "") + id);
}
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("Removed message " + messageId + " on queue "
+ (queue instanceof AMQQueue ? ((AMQQueue) queue).getName() + " with id " : "") + id
+ " from delivery db");
}
}
catch (DatabaseException e)
{
LOGGER.error("Failed to dequeue message " + messageId + ": " + e.getMessage(), e);
LOGGER.error(tx);
throw new AMQStoreException("Error accessing database while dequeuing message: " + e.getMessage(), e);
}
}