Beispiele
PHP Manual

Messages

Messages sent to and received from queues are represented by the SAMMessage object. The SAMMessage object encapsulates the body of the message (if one exists) and the header properties associated with the message. A SAMMessage object is either supplied as a parameter to a messaging operation or returned as a result.

Beispiel #1 Creating a message with a simple text body

<?php
$msg 
= new SAMMessage('This is a simple text message');
?>

Messages may have header properties associated with them that provide control over the transport of the message or further information to the receiving application. By default message properties are delivered to the underlying messaging system as strings and in this case they may be set with the following simple syntax:

Beispiel #2 Setting a text format property using the default syntax

<?php
$msg
->header->myPropertyName 'textData';
?>

If it is desired to pass type information an alternative syntax may be used where the value and the type hint are passed in an associative array:

Beispiel #3 Setting a property using a type hint

<?php
$msg
->header->myPropertyName = array(3.14159SAM_FLOAT);
?>

Properties may also be extracted from the header of a message.

Beispiel #4 Retrieving a property from a message header

<?php
$myProperty 
$msg->header->myPropertyName;
?>


Beispiele
PHP Manual