/** * Initializes the message with the array * to send to the queue. * * @param array $message The array with the data to send */ public function __construct(array $message) { // call parent constructor parent::__construct(); // initialize the HashMap sent with the message $this->message = $message; // initialize the message id $this->messageId = Uuid::uuid4()->__toString(); }
/** * Initializes the message with the Integer * to send to the queue. * * @param integer $message The integer with the data to send * * @throws \Exception Is thrown if the passed message is not a valid integer value */ public function __construct($message) { // call parent constructor parent::__construct(); // check if we've an integer passed if (is_integer($message) === false) { throw new \Exception(sprintf('Message \'%s\' is not a valid integer', $message)); } // initialize the integer sent with the message $this->message = $message; // initialize the message id $this->messageId = Uuid::uuid4()->__toString(); }