downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

Publicar/Suscribir y suscripción a temas (topics)> <Mensajes
[edit] Last updated: Fri, 24 May 2013

view this page in

Operaciones de mensajería

Todas las operaciones de mensajería se realizan a través de llamadas a métodos sobre el objeto de conexión. Para añadir un mensaje a una cola se utiliza en método "send" , para obtener un mensaje de una cola se utiliza el método "receive". Otros métodos proporcionan otras funcionalidades como la publicación, suscripción o el control sobre las transacciones.

Ejemplo #1 Añadir un mensaje a una cola y recibir una respuesta

<?php
$msg 
= new SAMMessage('Este es un mensaje simple de texto');
$msg->header->SAM_REPLY_TO 'queue://receive/test';
$correlid $conn->send('queue://send/test'$msg);

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



add a note add a note User Contributed Notes Operaciones de mensajería - [1 notes]
up
0
a dot hoyau at silexlabs dot org
1 year ago
Hello

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 http://project-sam.awardspace.com/overview.htm

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: http://php-polling.sourceforge.net/

Hoping this will make you save time!

 
show source | credits | sitemap | contact | advertising | mirror sites