Пример #1
0
 /**
  * Delete a message from a queue
  *
  * @param string $queue The queue containing the message to delete
  * @param string $receipt_handle The request id of the message to delete
  * @return boolean
  */
 public static function deleteMessage($queue, $receipt_handle)
 {
     $rest = new SQSRequest(self::$endpoint, $queue, 'DeleteMessage', 'DELETE', self::$__accessKey);
     $rest->setParameter('ReceiptHandle', $receipt_handle);
     $rest = $rest->getResponse();
     if ($rest->error === false && $rest->code !== 200) {
         $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
     }
     if ($rest->error !== false) {
         Amazon_SQS::__triggerError(__FUNCTION__, $rest->error);
         return false;
     }
     return true;
 }
Пример #2
0
 /**
  * Remove a permission from a queue
  *
  * @param string $queue The queue to which the permission will be added
  * @param string $label A unique identifier for the new permission
  * @return An array containing the request id
  */
 public function removePermission($queue, $label)
 {
     $rest = new SQSRequest($this, $queue, 'RemvoePermission', 'POST');
     $rest->setParameter('Label', $label);
     $rest = $rest->getResponse();
     if ($rest->error === false && $rest->code !== 200) {
         $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
     }
     if ($rest->error !== false) {
         $this->__triggerError(__FUNCTION__, $rest->error);
         return null;
     }
     $results = array();
     $results['RequestId'] = (string) $rest->body->ResponseMetadata->RequestId;
     return $results;
 }
Пример #3
0
 /**
  * Delete a message from the queue
  *
  * @param string $queue
  * @param string $receipt_handle
  * @return bool
  */
 public function delete($queue, $receipt_handle)
 {
     $req = new SQSRequest('DeleteMessage', $this->id, $this->secret, $queue);
     $req->ReceiptHandle = $receipt_handle;
     $req->send("/{$queue}/");
     return true;
 }