diff --git a/reference/amqp/amqpconnection/connect.xml b/reference/amqp/amqpconnection/connect.xml new file mode 100644 index 0000000000..c6f1861d37 --- /dev/null +++ b/reference/amqp/amqpconnection/connect.xml @@ -0,0 +1,85 @@ + + + + + + AMQPConnection::connect + Establish a connection with the AMQP broker. + + + + &reftitle.description; + + public booleanAMQPConnection::connect + + + + This method will initiate a connection with the AMQP broker. + + + + + &reftitle.parameters; + + void + + + + + &reftitle.returnvalues; + + Returns true if connection was successful, false otherwise. + + + + + &reftitle.examples; + + + <function>AMQPConnection::connect</function> example + +setLogin('mylogin'); +$cnn->setPassword('mypass'); + +if (!$cnn->connect()) { + throw new Exception('Could not connect'); +} + + +?> +]]> + + + + + + + + + diff --git a/reference/amqp/amqpconnection/disconnect.xml b/reference/amqp/amqpconnection/disconnect.xml new file mode 100644 index 0000000000..43e4127d1e --- /dev/null +++ b/reference/amqp/amqpconnection/disconnect.xml @@ -0,0 +1,91 @@ + + + + + + AMQPConnection::disconnect + Closes the connection with the AMQP broker. + + + + &reftitle.description; + + public booleanAMQPConnection::disconnect + + + + This method will close an open connection with the AMQP broker. + + + + + &reftitle.parameters; + + void + + + + + &reftitle.returnvalues; + + Returns true if connection was successfully closed, false otherwise. + + + + + &reftitle.examples; + + + <function>AMQPConnection::disconnect</function> example + +setLogin('mylogin'); +$cnn->setPassword('mypass'); + +if (!$cnn->connect()) { + throw new Exception('Could not connect'); +} + +// do something interesting + +if (!$cnn->disconnect()) { + throw new Exception('Could not disconnect'); +} + + +?> +]]> + + + + + + + + + diff --git a/reference/amqp/amqpconnection/isconnected.xml b/reference/amqp/amqpconnection/isconnected.xml index 8050b1e1b9..3ddceb9ca7 100644 --- a/reference/amqp/amqpconnection/isconnected.xml +++ b/reference/amqp/amqpconnection/isconnected.xml @@ -27,7 +27,7 @@ &reftitle.returnvalues; - + Returns true if connected, false otherwise diff --git a/reference/amqp/amqpconnection/reconnect.xml b/reference/amqp/amqpconnection/reconnect.xml new file mode 100644 index 0000000000..534dbaaecf --- /dev/null +++ b/reference/amqp/amqpconnection/reconnect.xml @@ -0,0 +1,91 @@ + + + + + + AMQPConnection::reconnect + Closes any open connection and creates a new connection with the AMQP broker. + + + + &reftitle.description; + + public booleanAMQPConnection::reconnect + + + + This method will close any open connections and initiate a new connection with the AMQP broker. + + + + + &reftitle.parameters; + + void + + + + + &reftitle.returnvalues; + + Returns true if reconnect was successful, false otherwise. + + + + + &reftitle.examples; + + + <function>AMQPConnection::reconnect</function> example + +setLogin('mylogin'); +$cnn->setPassword('mypass'); + +if (!$cnn->connect()) { + throw new Exception('Could not connect'); +} + +// do something interesting + +// ensure we have a valid connection +if (!$cnn->reconnect()) { + throw new Exception('Could not reconnect'); +} + +?> +]]> + + + + + + + + + diff --git a/reference/amqp/amqpconnection/sethost.xml b/reference/amqp/amqpconnection/sethost.xml new file mode 100644 index 0000000000..22eb6e03e0 --- /dev/null +++ b/reference/amqp/amqpconnection/sethost.xml @@ -0,0 +1,88 @@ + + + + + + AMQPConnection::setHost + Set the amqp host. + + + + &reftitle.description; + + public voidAMQPConnection::setHost + stringhost + + + This method will set the hostname used to connect to the AMQP broker. + + + + + &reftitle.parameters; + + + + host + + + The hostname of the AMQP broker. + + + + + + + + + &reftitle.returnvalues; + + void + + + + + &reftitle.examples; + + + <function>AMQPConnection::setHost</function> example + +setHost('myhost.com'); + +?> +]]> + + + + + + + + + diff --git a/reference/amqp/amqpconnection/setlogin.xml b/reference/amqp/amqpconnection/setlogin.xml new file mode 100644 index 0000000000..2da3a737ac --- /dev/null +++ b/reference/amqp/amqpconnection/setlogin.xml @@ -0,0 +1,88 @@ + + + + + + AMQPConnection::setLogin + Set the login. + + + + &reftitle.description; + + public voidAMQPConnection::setLogin + stringlogin + + + This method will set the login string used to connect to the AMQP broker. + + + + + &reftitle.parameters; + + + + login + + + The login string used to authenticate with the AMQP broker. + + + + + + + + + &reftitle.returnvalues; + + void + + + + + &reftitle.examples; + + + <function>AMQPConnection::setLogin</function> example + +setLogin('myusername'); + +?> +]]> + + + + + + + + + diff --git a/reference/amqp/amqpconnection/setpassword.xml b/reference/amqp/amqpconnection/setpassword.xml new file mode 100644 index 0000000000..f77348b14b --- /dev/null +++ b/reference/amqp/amqpconnection/setpassword.xml @@ -0,0 +1,88 @@ + + + + + + AMQPConnection::setPassword + Set the password. + + + + &reftitle.description; + + public voidAMQPConnection::setPassword + stringpassword + + + This method will set the password string used to connect to the AMQP broker. + + + + + &reftitle.parameters; + + + + password + + + The password string used to authenticate with the AMQP broker. + + + + + + + + + &reftitle.returnvalues; + + void + + + + + &reftitle.examples; + + + <function>AMQPConnection::setPassword</function> example + +setPassword('mypassword'); + +?> +]]> + + + + + + + + + diff --git a/reference/amqp/amqpconnection/setport.xml b/reference/amqp/amqpconnection/setport.xml new file mode 100644 index 0000000000..f72be1e74f --- /dev/null +++ b/reference/amqp/amqpconnection/setport.xml @@ -0,0 +1,88 @@ + + + + + + AMQPConnection::setPort + Set the port. + + + + &reftitle.description; + + public voidAMQPConnection::setPort + intport + + + This method will set the port used to connect to the AMQP broker. + + + + + &reftitle.parameters; + + + + port + + + The port used to connect to the AMQP broker. + + + + + + + + + &reftitle.returnvalues; + + void + + + + + &reftitle.examples; + + + <function>AMQPConnection::setPort</function> example + +setPort(5672); + +?> +]]> + + + + + + + + + diff --git a/reference/amqp/amqpqueue/consume.xml b/reference/amqp/amqpqueue/consume.xml index bffff1e5be..ea379df556 100644 --- a/reference/amqp/amqpqueue/consume.xml +++ b/reference/amqp/amqpqueue/consume.xml @@ -11,8 +11,7 @@ &reftitle.description; public voidAMQPQueue::consume - stringnum_messages - stringflagsNULL + arrayoptions @@ -27,18 +26,13 @@ - num_messages + options - + options is a an array of consume options. The keys used in the options array are: min, max, and ack. All other keys will be ignored. - - - - flags - - - + + For each missing option, the extension will check the ini settings or use the default value. @@ -49,10 +43,49 @@ &reftitle.returnvalues; - + An array contained a the messages consumed. The number of returned messages will be at least the number given by min in the options array. But not more than the number given by max. + + &reftitle.examples; + + + <function>AMQPQueue::consume</function> example + +declare('myqueue'); + +$options = array( + 'min' => 1, + 'max' => 10, + 'ack' => true +); + +//get the messages +$messages = $queue->consume($options); + +foreach ($messages as $message) { + echo $message['message_body']; +} + +?> +]]> + + + + + +