Let's talk Contact us. No cost. No obligation.

Fill out this form and we will contact you with in 24 hrs.

    captcha

     

    Knowledge Base

    Amazon SQS queues

    April 21, 2014

    Amazon Simple Queue Service: offers a reliable, highly scalable, hosted queue for storing messages. Amazon SQS can be used to applications that perform different tasks, without losing messages. Amazon SQS enables users to build an automated workflow.

    Features of Amazon SQS:

    a) Single Amazon SQS queue can be shared by multiple servers simultaneously.
    b) Server that is processing a message can prevent other servers from processing the same message at the same time using temporarily “locking” a message. The server can specify the amount of time the message is locked. When the server is done processing the message, it should delete the message. If the server fails while processing the message, another server can get the message after the lockout period.

    Pipeline processing with Amazon SQS:

    a) Flexibility: Large monolithic server can be divided into multiple smaller servers without impacting the current system.

    b) Piecemeal upgrades: Individual sub-components can be taken offline / upgraded without bringing the entire system down.

    c) Tolerance to failures: Amazon SQS isolates sub-components from each other so the failure of one component does not impact the rest.

    require_once(‘lib/Zend/Service/Amazon/Sqs.php’);

    define(‘AWS_ACCESS_KEY_ID’,”);

    define(‘AWS_SECRET_ACCESS_KEY’,”);

    define(‘SQS_TEST_MESSAGE’,’WelcometoSQS.’);

    try

    {

    $q =new Zend_Service_Amazon_Sqs(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)

    //createQueue

    $result=$q-> create(‘SQS-Queue-Testing’);

    //listQueue

    $result=$q->getQueues();

    //sendmessage to Queue

    $messageId=$q->send(urlencode(SQS_TEST_MESSAGE));

    //receive messagefromQueue

    $messages=$q->receive();

    }

    catch(Exception $e)

    {

    echo ‘Exception occurred:’,$e->getMessage(), ” n < br /> n”
    }

    ?>

    About Avadhesh Purwar

    Avadhesh Purwar http://www.google.com