-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix iteration of queue messages #448
Fix iteration of queue messages #448
Conversation
… element but provides one in the nextUrl.
We can probably apply these changes to a new This will isolate the changes to just this service and mitigate the risk of other things breaking. If this only applies to a single operation (like ListMessages), you could restrict the scope of the new class to this operation only - and have all the other Queues collection operations go through the base class. |
… one per element but provides one in the nextUrl." This reverts commit eb5580a.
@jamiehannaford I've taken your advice and created a custom iterator. This PR is ready for review now. Thank you! |
Yes, of course. I'll see if I can pull in phpunit's assertion framework and use it for this. |
Fix iteration of queue messages
The motivation for this PR is https://community.rackspace.com/developers/f/7/p/4494/11318#11318.
This PR introduces a custom iterator (
OpenCloud\Queues\Collection\MessageIterator
) for iterating over the results of$queue->listMessages()
. This is necessary because the underlying HTTP API's response, unlike other paginated list API responses, does not expose the marker property in each item (message) in the list of items (messages) returned. The commonPaginatedIterator
class relies on this API idiom and, therefore, cannot be used as-is for this particular API.