Amazon SQS and Zend Framework

Leave a comment

I’m doing some work for a webinar and I figured out that if you want use AWS SQS in your app you need to specify not just the queue name, but the full URL.  What is the full URL?  It is what createQueue() returns.

For example, I was doing this to store the queue name in a task that was stored in the session so I could get it at a later point in time:

1
2
$this->_queueName = sha1('fileProcess-' . $this->_sourceId);
$queue->createQueue($this->_queueName);

What I needed to be doing instead was this

1
2
$this->_sourceId = sha1(uniqid(php_uname(), true));
$this->_queueName = $queue->createQueue(sha1('fileProcess-' . $this->_sourceId));

Additionally, you have no guarantee of order with SQS.  In other words, there is no guarantee that the messages you receive will be in the order that they were sent.  So you will need to build your own mechanism for handling that if you have a need for a FIFO MQ in AWS.

Leave a Reply

Your email address will not be published. Required fields are marked *