/** * Class constructor * * @param string|array|object $messageBody * @param array $properties */ public function __construct($messageBody, array $properties = array()) { // JSON-encode all messages; getPayload() will decode the messages $this->body = json_encode($messageBody, JSON_FORCE_OBJECT); // Set default properties if (empty($properties)) { $properties = array('content_type' => 'text/plain', 'delivery_mode' => 2); } // Call the parent class constructor parent::__construct($properties, static::$PROPERTIES); // Discard this message after 60 seconds if not acknowledged $this->set('expiration', $this->expiration); $this->set('application_headers', array('x-retry_count' => array('I', 0))); }
/** * @param string $body * @param null $properties */ public function __construct($body = '', $properties = null) { $this->setBody($body); parent::__construct($properties, static::$propertyDefinitions); }
public function __construct($body = '', $properties = null) { $this->body = $body; parent::__construct($properties, static::$PROPERTIES); }