__construct() public method

public __construct ( array $properties, array $propertyTypes = null )
$properties array Message property content
$propertyTypes array Message property definitions
Beispiel #1
0
 /**
  * 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)));
 }
Beispiel #2
0
 /**
  * @param string $body
  * @param null $properties
  */
 public function __construct($body = '', $properties = null)
 {
     $this->setBody($body);
     parent::__construct($properties, static::$propertyDefinitions);
 }
Beispiel #3
0
 public function __construct($body = '', $properties = null)
 {
     $this->body = $body;
     parent::__construct($properties, static::$PROPERTIES);
 }