Skip to content


Subversion checkout URL

You can clone with
Download ZIP
branch: master

Duplicated namespace level consts as class consts and switched the

internal API  to use  class level  consts.  Nsp  level consts  are now
present for backwards compat purposes only.
latest commit d99b60f368
@BraveSirRobin authored

Amqphp basic demos

There are 3 scripts to demostrate the most basic usage of Amqphp:

  1. get.php - use the basic.get amqp method to retrieve a single message
  2. producer.php - use the basic.publish amqp method to publish one or more messages.
  3. consumer.php - set up a consumer to receive messages.

The first of these is very simple, the other 2 accept command line options which vary their behaviour, use a --help switch for more information.


Before you run the demos you must set up an Amqp broker, edit the connection parameters in configs/rabbit1-host-config.xml to suit your environment.

First, publish some messages:

php producer.php --message="Hello, world" --repeat=5

Now, read one of these back from the broker using get:

php get.php

You should have 4 left - read these back using consume:

php consumer.php --strat="trel 1 0"

The --strat switch adds an exit strategy to the connection, without this the script will never end (until you kill it with Ctrl-C, of course).

Here's an interesting one - set up a consumer that listens to and prints out all "system messages" from the RabbitMQ broker:

php consumer.php --consumer rmq-mon-q \
    --config configs/log-and-trace-connection.xml
Something went wrong with that request. Please try again.