Created
September 14, 2014 07:56
-
-
Save DustyReagan/acd99e2d9e4c103586fe to your computer and use it in GitHub Desktop.
Rackspace Queue API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include_once(APPLICATION_PATH . '/../library/vendor/autoload.php'); | |
use OpenCloud\Rackspace; | |
$client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array( | |
'username' => 'myusername', | |
'apiKey' => 'myapikey' | |
)); | |
$service = $client->queuesService('cloudQueues', 'DFW'); | |
$queue = $service->getQueue('FoF'); | |
$stats = $queue->getStats(); | |
print_r($stats); | |
use OpenCloud\Common\Constants\Datetime; | |
$messages = array( | |
array( | |
'body' => (object) ['property' => 'Here we go'], | |
'ttl' => 2 * Datetime::DAY | |
) | |
); | |
$response = $queue->createMessages($messages); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Produces:
stdClass Object ( [claimed] => 0 [total] => 0 [free] => 0 )
Fatal error: Uncaught exception 'Guzzle\Http\Exception\ClientErrorResponseException' with message 'Client error response [status code] 400 [reason phrase] Bad Request [url] https://dfw.queues.api.rackspacecloud.com/v1/404082/queues/FoF/messages' in /var/sites/FriendOrFollowDusty/library/vendor/guzzle/http/Guzzle/Http/Exception/BadResponseException.php:43 Stack trace: #0 /var/sites/FriendOrFollowDusty/library/vendor/guzzle/http/Guzzle/Http/Message/Request.php(145): Guzzle\Http\Exception\BadResponseException::factory(Object(Guzzle\Http\Message\EntityEnclosingRequest), Object(Guzzle\Http\Message\Response)) #1 [internal function]: Guzzle\Http\Message\Request::onRequestError(Object(Guzzle\Common\Event), 'request.error', Object(Symfony\Component\EventDispatcher\EventDispatcher)) #2 /var/sites/FriendOrFollowDusty/library/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php(164): call_user_func(Array, Object(Guzzle\Common\Event), 'request.error', Object(Symfony\Component\EventDispatcher\EventDispa in /var/sites/FriendOrFollowDusty/library/vendor/guzzle/http/Guzzle/Http/Exception/BadResponseException.php on line 43