Message Queue will be discontinued on March 1, 2017. IBM Bluemix (Formerly SoftLayer) will discontinue support on January 31, 2017.
After placing an order for the Message Queue service, the API endpoints for the datacenter you selected during the order process can be located in the SoftLayer Customer Portal alongside your user name, account ID, and API, using the following steps:
Your user name and API key will be displayed in the credentials dialog:
NOT FOUND: intro-part1-account-credentials.jpg
Note: if you have more than one user account in your SoftLayer customer account, and you wish to use a specific account for interacting with the Message Queue API, simply repeat these steps by logging in as that user account.
In the above examples, our account information for this example is as follows:
These three items will be required when we authenticate to the service.
Now that we have our credentials, we can begin writing our application. For this example series, we'll use PHP.
<?php require('softlayer-queue-php-client/src/SoftLayer/Messaging.php'); // Replace these values with your own. define('QUEUE_ACCOUNT', '5yc2z'); define('QUEUE_USERNAME', 'happycustomer'); define('QUEUE_API_KEY', '98b0c8158e633d5c5ed63ad24584cadfa0e6e047c4c9e7e3adb3368aaa029640'); $messaging = new SoftLayer_Messaging(); if ($messaging->authenticate(QUEUE_ACCOUNT, QUEUE_USERNAME, QUEUE_API_KEY)) { echo "Welcome to the SoftLayer Message Queue!" . PHP_EOL; }
In this example, we simply attempt authentication. If successful, we should see the welcome message.
Now that we've successfully authenticated, we should be able to perform a simple operation against our account, such as getting a list of all the queues created on our account thus far:
$queues = $messaging->queues(); echo "There are " . count($queues) . " queues on your account." . PHP_EOL;
Since this is the first time we've used the queue service, this will simply tell us we have zero queues so far--but is a simple way to test the API.
Check out Message Queue: Exploring Queues we'll explore queues in much greater depth, and Message Queue: Exploring Topics will explain more advanced use cases through the use of topics.