php-doc-en/reference/amqp/examples.xml
Pieter de Zwart 953e9ec5b2 Updating examples to be in line with new API
Fixing typo


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@306826 c90b9560-bf6c-de11-be94-00142212c4b1
2010-12-29 18:29:18 +00:00

58 lines
1.2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<chapter xml:id="amqp.examples" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.examples;
<example>
<title>AMQP Example</title>
<programlisting role="php">
<![CDATA[
<?php
// Create a connection
$cnn = new AMQPConnection();
$cnn->connect();
// Declare a new exchange
$ex = new AMQPExchange($cnn);
$ex->declare('exchange1', AMQP_EX_TYPE_FANOUT);
// Create a new queue
$q = new AMQPQueue($cnn);
$q->declare('queue1');
// 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 = $q->consume();
?>
]]>
</programlisting>
</example>
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->