/**
* Ensures that the <code>next</code> points to the correct item, possibly reading from the dbCursor.
*/
private function initializeNextItem()
{
while (!$this->messagesToReturn->valid() && $this->dbCursor->hasNext()) {
$cb = $this->callback;
$this->messagesToReturn = new \ArrayIterator($cb($this->dbCursor->getNext(), $this->actualAggregateIdentifier));
}
$this->next = $this->messagesToReturn->current();
$this->messagesToReturn->next();
}