Examples

Example #1 AMQP Example

<?php

// Create a connection
$cnn = new AMQPConnection();

// Declare a new exchange
$ex = new AMQPExchange($cnn);
$ex->declare('exchange1'AMQP_EX_TYPE_FANOUT);

// Create a new queue
$q = new AMQPQueue($cnn'queue1');
$q->declare();

// Bind it on the exchange to routing.key
$ex->bind('queue1''routing.key');

// Publish a message to the exchange with a routing key
$ex->publish('message''routing.key');

// Read from the queue
$msg $queue->consume(1);

?>

Copyright © 2010-2024 Platon Technologies, s.r.o.           Home | Man pages | tLDP | Documents | Utilities | About
Design by styleshout