PHP 7.2.0 Beta 3 Released

Messaging operations

All messaging operations are performed through calls to methods on the connection object. To add a message to a queue the "send" method is used, to obtain a message from a queue the "receive" method is used. Other methods provide publish and subscribe functionality and control of transaction boundaries.

Exemplo #1 Adding a message to a queue and receiving a response

= new SAMMessage('This is a simple text message');
$msg->header->SAM_REPLY_TO 'queue://receive/test';
$correlid $conn->send('queue://send/test'$msg);

if (!
$correlid) {
// The Send failed!
echo "Send failed ($conn->errno$conn->error";
} else {
$resp $conn->receive('queue://receive/test', array(SAM_CORRELID => $correlid));

add a note add a note

User Contributed Notes 1 note

a dot hoyau at silexlabs dot org
5 years ago

I think that most people people coming here are looking to do this on client side, in client/server web applications

Sam is not made for this, but to connect servers together - systems in fact. See

Since PHP is stateless it is really hard to do collaborative applications with a PHP back-end and very few solutions exist. So, for those looking for this, I put here a link to a messaging server in PHP - free open source and community driven:

Hoping this will make you save time!
To Top