示例#1
0
 public function close()
 {
     if ($this->closed) {
         return;
     }
     $this->closed = true;
     $this->emit('close');
     $this->removeAllListeners();
     $this->connection->close();
 }
示例#2
0
 /**
  * Handles the given data.
  *
  * @param string              $data       Consumed data
  * @param string              $consumer   Command to execute
  * @param ConnectionInterface $connection The connection to the producer
  *
  * @return void
  */
 public function handleData($data, $consumer, ConnectionInterface $connection, $callback = null)
 {
     $command = sprintf('%s "%s"', $consumer, addslashes($data));
     if ($callback && is_callable($callback)) {
         call_user_func($callback, $data);
     }
     $this->processFactory->newProcess($command)->run();
     $connection->close();
 }