Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 17680 программистов и 1735 роботов. Сейчас ищут 1348 программистов ...
Приступая к работе

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.

Пример #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:

Пример #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:

Пример #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.

Пример #4 Retrieving a property from a message header

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



Вернуться к: Примеры

© 2024 «PHP.RU — Сообщество PHP-Программистов»
Главная | Форум | Реклама на сайте | Контакты VIP Сувениры
Разработка компании ODware