Example #1
0
 public function __construct(Queue\Client $queue, $data)
 {
     $store = $queue->getStore()->getMessagesStore();
     $this->promisesStore = $queue->getStore()->getPromisesStore();
     $promise = new PromiseClient($this->promisesStore);
     $data = is_null($data) ? [Store::QUEUE_ID => $queue->getId(), Store::PROMISE => $promise->getId()] : is_array($data) ? array_merge($data, [Store::QUEUE_ID => $queue->getId(), Store::PROMISE => $promise->getId()]) : $data;
     parent::__construct($store, $data);
     $this->queue = $queue;
 }
Example #2
0
 public function __construct(Store $store, $data = null)
 {
     parent::__construct($store, $data);
     $this->messagesStore = $this->getStore()->getMessagesStore();
     $this->promisesStore = $this->getStore()->getPromisesStore();
 }
Example #3
0
 protected function runTransaction($methodName, $param1 = null, $params2 = null)
 {
     $data = $this->getStoredData();
     $id = parent::runTransaction($methodName, $param1, $params2);
     $dataReturned = $this->getStoredData($id);
     if ($data[Store::STATE] === PromiseInterface::PENDING && ($dataReturned[Store::STATE] === PromiseInterface::FULFILLED || $dataReturned[Store::STATE] === PromiseInterface::REJECTED)) {
         $result = (new static($this->store, $id))->wait(false);
         $this->resolveDependent($result, $dataReturned[Store::STATE] === PromiseInterface::REJECTED);
     }
     return $id;
     //$dataReturned;
 }