/** * Save the current message instance into de queue server * * @return void */ public function save() { try { $connection = new Connection($this->buildConnectionOptions()); $connection->open(); $msg = new AMQPMessage($this->message, array('content_type' => $this->content_type, 'delivery_mode' => 2)); $connection->channel->basic_publish($msg, $this->exchange, $this->queue_name); $connection->close(); } catch (Exception $e) { $connection->close(); throw new Exception($e); } }
/** * Save the current message instance into de queue server * * @return void */ public function save() { try { $connection = new Connection($this->buildConnectionOptions()); $connection->open(); $msg = new AMQPMessage($this->message, array('content_type' => 'text/plain', 'delivery_mode' => 2)); if ($this->delay) { $headers = new AMQPTable(["x-delay" => $this->delay]); $msg->set('application_headers', $headers); } $connection->channel->basic_publish($msg, $this->queue_name); $connection->close(); } catch (Exception $e) { $connection->close(); throw new Exception($e); } }