Skip to content

Documentation on Queue Messages Missing Important Info #696

Open
@dmagoo

Description

@dmagoo

The following code from the documentation threw me for a loop. Nowhere could I find documentation of what sort of object "listMessages" returns. It happens to be a MessageIterator, which is a subclass of a PaginatedIterator. This is confusing, because, when I query a queue with 20 items with a limit of say, 5, the foreach loop still iterates through all 20. I'm not sure if this is a bug or feature because of lack of documentation. If this is not a bug, it is unclear how to correctly list only the 5 items.

http://php-opencloud.readthedocs.io/en/latest/services/queues/messages.html

$messages = $queue->listMessages(array(
    'marker' => '51db6f78c508f17ddc924357',
    'limit'  => 20,
    'echo'   => true
));

foreach ($messages as $message) {
    echo $message->getId() . PHP_EOL;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions