ZF-12368: Zend_Cloud_QueueService_Adapter_Sqs wrong use of const CREATE_TIMEOUT, cannot set visibility timeout when creating new queues

Description

in v1.11.7, in Class "Zend_Cloud_QueueService_Adapter_Sqs" (Zend/Cloud/QueueService/Adapter/Sqs.php)

look at this part of the code in the function "createQueue":
public function createQueue($name, $options = null) { try { return $this->_sqs->create($name, $options[self::CREATE_TIMEOUT]); } catch(Zend_Service_Amazon_Exception $e) { throw new Zend_Cloud_QueueService_Exception('Error on queue creation: '.$e->getMessage(), $e->getCode(), $e); } }

here is how the CREATE_TIMEOUT is defined on top of this file : const CREATE_TIMEOUT = 30;

my issue is the wrong use of const self::CREATE_TIMEOUT in the createQueue function : the const first defines a "VALUE" for the visibility timer but is then used as an "ID" in the options Array passed to the create function

so if im not wrong (i tested this case successfully) this means the only way to specify a timeout of 10 seconds at queue creation is : $mySQSAdapter->createQueue("myQueue",Array(30=>10));

which isn't very logic.

=> a better way would be to define the const as so : const CREATE_TIMEOUT = 'visibility_timeout'; and then you could create a queue as so : $mySQSAdapter->createQueue("myQueue",Array('visibility_timeout'=>30));

it finally would be really nice to update the doc shown here accordingly :http://framework.zend.com/manual/en/…

This is my first ZF Issue post, please feel free to comment if im wrong or if i miss something here.

Thanks in advance Emmanuel BOTROS

Comments

No comments to display