Git Product home page Git Product logo

php-amqp's Introduction

PHP AMQP bindings Test

Object-oriented PHP bindings for the AMQP C library (https://github.com/alanxz/rabbitmq-c)

Requirements:

  • PHP >= 7.4 with either ZTS or non-ZTS version.
  • Starting with php-amqp 2.0.0 at least version 0.8.0 of librabbitmq is required (at least 0.10.0 is recommended)
  • to run tests RabbitMQ server >= 3.4.0 required.

Installation

Linux

Some systems have php-amqp extension available in their package repositories or available via an external repository so it is MAY be the preferable way to install.

Fresh php-pecl-amqp and librabbitmq RPMs available via remi repo.

If you want to stay on the bleeding edge and have the latest version, install php-amqp extension from PECL or compile from sources (follow PHP official docs instruction).

Windows

  • Before download, check if your PHP installation is thread safe or non-thread safe by entering php -i|findstr " Thread" in your terminal
  • Download thread safe or non-thread safe version of the extension for your PHP version from https://pecl.php.net/package/amqp. Look for the "DLL" link next to each release in the list of available releases
  • After download, copy the rabbitmq.4.dll and rabbitmq.4.pdb files to the PHP root folder and copy php_amqp.dll and php_amqp.pdb files to PHP\ext folder
  • Add extension=amqp to the php.ini file
  • Check if the module is properly installed with php -m

Documentation

Check out the official RabbitMQ tutorials as well as the php-amqp specific examples.

There are also stub files available that document the API of PHP AMQP. These stubs can also be used in your IDE for code completion, navigation and documentation.

Check out the upgrading guide to check breaking changes between versions, e.g. from 1.x to 2.x.

Finally, check out the tests to see usage examples and edge cases.

Notes & limitations

  • You can't share any of AMQP API objects (AMQPConnection, AMQPChannel, AMQPQueue, AMQPExchange) between threads. Use a separate connection per thread.
  • There may only be one persistent connection per connection information. If there will be an attempt to create another persistent connection with the same credentials, an exception will be thrown.
  • Channels on persistent connections are not persistent: they are destroyed between requests.
  • Heartbeats are limited to blocking calls only, so if there are no any operations on a connection or no active consumer set, connection may be closed by the broker as dead.

Related libraries

How to report a problem

  1. First, search through the closed issues and stackoverflow.com.
  2. Submit an issue with short and definitive title that describe your problem
  3. Provide platform info, PHP interpreter version, SAPI mode (cli, fpm, cgi, etc) the extension is used in, php-amqp extension version, librabbitmq version, make tools version.
  4. Description should provide information on how to reproduce a problem (gist is the most preferable way to include large sources) in a definitive way. Use Vagrant to replicate unusual environments.
  5. If stack trace is generated, include it in full via gist or the important part (if you definitely know what you are doing) directly in the description.

Things to check before reporting a problem

Some of them, the list is not complete.

  1. You are running on correct machine in correct environment and your platform meets your application requirement.
  2. librabbitmq is installed and discoverable in your environment so php-amqp extension can load it.
  3. php-amqp extension present in system (find amqp.so or amqp.dll if you are on windows), it is loaded (php --ri amqp produced some info), and there are no underlying abstraction that MAY emulate php-amqp work.
  4. You hav correct RabbitMQ credentials.
  5. You are using the latest php-amqp, librabbitmq, RabbitMQ and sometimes PHP version itself. Sometimes your problem is already solved.
  6. Other extensions disabled (especially useful when PHP interpreter crashes, and you get a stack trace and segmentation fault).

Development

See DEVELOPMENT.md for details.

php-amqp's People

Contributors

ahilles107 avatar andrew-demb avatar bkw avatar cmb69 avatar coodix avatar dependabot[bot] avatar empi89 avatar flavioheleno avatar jan-e avatar javer avatar kinncj avatar klkvsk avatar lstrojny avatar lyrixx avatar mlocati avatar narkq avatar pdezwart avatar petk avatar pinepain avatar prolic avatar remicollet avatar sergeyklay avatar siad007 avatar sqmk avatar supersmile2009 avatar tezhm avatar tim-bezhashvyly avatar vkartaviy avatar weltling avatar xodmqjw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-amqp's Issues

Invalid AMQP exceptions handling

According to AMQP Specification, section 4.8 - "Error Handling" on some kind or exception as they declared in section 1.2. - "AMQP­ defined Constants" we have to close channel or even connection (with all of it channels) and mark those object as disconnected to prevent their further usage in case of try-catch application survive.

In case of re-declaring already existent exchange with different params we doesn't properly close channel, which may lead in unexpected behavior when same channel being used.

See test case for this issue.

For example, when we utilize such channel for message publishing we'll receive successful result for AMQPExchange::publish, but no message is published in fact.

P.S.: there are may be some other places in sources where we do not handle properly AMQP exceptions.

Wrong structures string fields size

I was searching for memory leaks in the evening (bug #63350) and found that we use 255 chars for string fields including terminator character '\0'. In fact broker use pure 255 characters for identifier. I didn't check that on envelope fields, but i have tested queue and exchange name and implement consumer tag with this fix (see my pull request #40).

This is a bit trivial bug and I will write a fix for it tomorrow evening, but maybe there is some hidden reason why it is so (255 and not 256)?

According to AMQP 0-9-1 spec (section 2.3.2 Data Types, and 4.2.5.3 Strings) short strings is 255 byts of UTF-8(?) data without binary zero, and we in fact wipe the last one with terminator when we receive string that is 255 bytes. It's an edge case, but I vote up to support specs.

See http://pastebin.com/XPkZatck for queues and http://pastebin.com/179GGfpQ for exchanges naming issue demonstration.

Segmentation fault if login incorrect

I tried to connect to RabbitMQ with wrong login/password.
I catched the exception "Library error: Die Ressource ist zur Zeit nicht verf\xc3\xbcgbar - Potential login failure.".
But on return out of my funktion there is a "child pid 17084 exit signal Segmentation fault (11)".

PHP 5.3.15

amqp
Version => 1.2.0
Revision => $Revision: 327551 $
Compiled => Aug 28 2013 @ 11:39:32
AMQP protocol version => 0-9-1
librabbitmq version => 0.3.0

bug 63350 from bugs.php.net

I confirm on Mac OS X 10.8.2. php version PHP 5.4.10 (tarball from 20 Dec 2012 with md5 cb716b657a30570b9b468b9e7bc551a1) from official php.net site, php-amqp from v1.0.9 branch from pdezwart repo. Strange that Instruments doesn't show any leeks.

I slightly modify initial script to reproduce the bug, just declare queue, because without any binded to exchange queue broker will drop message and we also cannot get message from nonexistent queue.

P.S.: looking on that with valgrind doesn’t looks optimistic.
valgrind --tool=memcheck --num-callers=30 --log-file=php.log /Users/pinepain/bin/php bug_63350_demo.php

Strange, that Instruments (tool from Xcode package) doesn't show any leaks or other problems.

Add AMQPQueue::delete message_count support

According to specs AMQPQueue::delete is idempotent, so in php-amqp implementation it can trow exception or return some value, which is true for now, but in fact we should return deleted messages count as to AMQP specs.

But should this be done in current release or moved to next major one?

Logically checking whether AMQPQueue::delete return true, especially doing strict check makes no sense, so adding this fix in current release should not break significantly users codebase.

P.S.: here is a gist with implementation

Non blocking AMQPQueue::consume

Hi @pdezwart

First of all, I really thank you that you've shared this great extension with community, I'm working in a project in which we are using it inside a Daemon (php client mode).

After been using it for a while we believe that the following improvement would be nice , as it would allow users to use consume method without blocking the execution. I will detail below how could be the flow using consume in non blocking way.

  1. Execute AMQPQueue::consume ( null, $flags )
  2. If consume method was not previously sent, send it, and store that consume has been enabled ( probably in an property called "consumer" that then could be returned calling a new AMQPQueue::isConsumer method)
  3. Call read_message_from_channel to retrieve a message (if any) from queue
  4. Continue exactly as AMQPQueue::get method is (return a new AMQPEnvelope if message was retrieved or false otherwise)

So to pass it clean two modifications to extension interface need to be done

  1. Change consume method to allow it to be called without callback:
    public void AMQPQueue::consume ( callable $callback = null [, int $flags = AMQP_NOPARAM ] )
  2. Add a new method
    public bool AMQPQueue::isConsumer ( )
    to retrieve if consume mechanism is enabled on it

We certainly believe this would be a great improvement to the extension, without involving a lot of development, moreover we can give you a hand with it.

What do you think?

Be well!

setReadTimeout does not work when server is down

When server is down, client can connect to the machine that hosts the server due to its security settings. But, connection hangs for a couple of minutes, and then it throws AMQPConnectionException with "Socket error: could not connect to host." message. Setting timeout value is not working.

memory leak with AMPQConnection::setHost()

Calling setHost() repeatedly results in a memory leak.

https://bugs.php.net/bug.php?id=66848

for ($ii = 0; $ii < 200; $ii++) {
    $amqp_connection = new \AMQPConnection();

    if ($ii % 50 == 0) echo $ii.' '.number_format(memory_get_usage()/1024).'KiB'.PHP_EOL;
}
echo $ii.' '.number_format(memory_get_usage()/1024).'KiB'.PHP_EOL.PHP_EOL;
for ($ii = 0; $ii < 200; $ii++) {
    $amqp_connection = new \AMQPConnection();
    $amqp_connection->setHost('127.0.0.1');           // only difference to above loop

    if ($ii % 50 == 0) echo $ii.' '.number_format(memory_get_usage()/1024).'KiB'.PHP_EOL;
}
echo $ii.' '.number_format(memory_get_usage()/1024).'KiB'.PHP_EOL.PHP_EOL;

Typical output showing how memory usage continues to grow in the second loop

0 224KiB
50 224KiB
100 224KiB
150 224KiB
200 224KiB

0 224KiB
50 226KiB
100 227KiB
150 229KiB
200 230KiB

{handshake_timeout,frame_header}

Are you able to shed some light on why we should be receiving the following log entries when using version 1.4.0-1? Attempts to connect fail with {handshake_timeout,frame_header}.

These are intermittent and do not appear to relate to high load on the server which has a load average of 0.0x most of the time. The publish rate to RabbitMQ is less than 0.5/sec.

=INFO REPORT==== 27-Apr-2014::05:05:02 ===
accepting AMQP connection <0.22398.229> (127.0.0.1:36025 -> 127.0.0.1:5672)

=INFO REPORT==== 27-Apr-2014::05:05:02 ===
accepting AMQP connection <0.22401.229> (127.0.0.1:36026 -> 127.0.0.1:5672)

=ERROR REPORT==== 27-Apr-2014::05:05:12 ===
closing AMQP connection <0.22398.229> (127.0.0.1:36025 -> 127.0.0.1:5672):
{handshake_timeout,frame_header}

=ERROR REPORT==== 27-Apr-2014::05:05:12 ===
closing AMQP connection <0.22401.229> (127.0.0.1:36026 -> 127.0.0.1:5672):
{handshake_timeout,frame_header}
# php -v
PHP 5.5.10 (cli) (built: Mar  6 2014 10:44:40)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
# php --ri amqp

amqp

Version => 1.4.0
Revision => $Revision: 327551 $
Compiled => Apr 23 2014 @ 09:03:55
AMQP protocol version => 0-9-1
librabbitmq version => 0.5.0

Directive => Local Value => Master Value
amqp.host => localhost => localhost
amqp.vhost => / => /
amqp.port => 5672 => 5672
amqp.timeout => no value => no value
amqp.read_timeout => 0 => 0
amqp.write_timeout => 0 => 0
amqp.connect_timeout => 0 => 0
amqp.login => guest => guest
amqp.password => guest => guest
amqp.auto_ack => 0 => 0
amqp.prefetch_count => 3 => 3
# yum list installed | grep rabbit
librabbitmq.x86_64               0.5.0-1.el6.remi          @remi
librabbitmq-devel.x86_64         0.5.0-1.el6.remi          @remi
librabbitmq-tools.x86_64         0.5.0-1.el6.remi          @remi
rabbitmq-server.noarch           3.3.0-1                   installed
# yum list installed | grep php
php55u.x86_64                    5.5.10-1.ius.el6          @rackspace-rhel-x86_64-server-6-ius
php55u-cli.x86_64                5.5.10-1.ius.el6          @rackspace-rhel-x86_64-server-6-ius
php55u-common.x86_64             5.5.10-1.ius.el6          @rackspace-rhel-x86_64-server-6-ius
php55u-devel.x86_64              5.5.10-1.ius.el6          @rackspace-rhel-x86_64-server-6-ius
php55u-gd.x86_64                 5.5.10-1.ius.el6          @rackspace-rhel-x86_64-server-6-ius
php55u-gmp.x86_64                5.5.10-1.ius.el6          @rackspace-rhel-x86_64-server-6-ius
php55u-imap.x86_64               5.5.10-1.ius.el6          @rackspace-rhel-x86_64-server-6-ius
php55u-mbstring.x86_64           5.5.10-1.ius.el6          @rackspace-rhel-x86_64-server-6-ius
php55u-mysqlnd.x86_64            5.5.10-1.ius.el6          @rackspace-rhel-x86_64-server-6-ius
php55u-pdo.x86_64                5.5.10-1.ius.el6          @rackspace-rhel-x86_64-server-6-ius
php55u-pear.noarch               1:1.9.4-20.ius.el6        @rackspace-rhel-x86_64-server-6-ius
php55u-pecl-jsonc.x86_64         1.3.5-1.ius.el6           @rackspace-rhel-x86_64-server-6-ius
php55u-process.x86_64            5.5.10-1.ius.el6          @rackspace-rhel-x86_64-server-6-ius
php55u-xml.x86_64                5.5.10-1.ius.el6          @rackspace-rhel-x86_64-server-6-ius
# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.5 (Santiago)

Consuming from multiple queues

I have tried to use AMQPQueue::consume with "return false" on two different queues on the same channel. However messages published to queue2 are received by the consumer of queue1. I don't believe this is expected behavior but I'm not totally sure if I'm using the methods as they are supposed to be used.

I have written a test proving the issue here:
https://github.com/empi89/php-amqp/blob/master/tests/amqpqueue_consume_basic_multiple_queues.phpt

You could find the travis-ci build here:
https://travis-ci.org/empi89/php-amqp/jobs/7545321

publisher confirms

We have an offer to sponsor work on publisher acknowledgements as described here

We'll gladly supply the contact to any volunteers. Just ping @pdezwart, @lstrojny or me for the details.

Queue bind does not accept additional arguments

RabbitMQ allows for header exchanges. Binding a queue to an exchange should be able send additional arguments as a list of matching headers.

It looks like the arguments value that is passed over to the c client sets arguments to null.

I'd expect the following to work in a near future release:

$queue->bind('exchange name', 'routing key', ['x-match' => 'all', 'type' =>'some value']);

AMQPConnection::connect() return value

In stubs and official docs method AMQPConnection::connect shown as one that may return boolean FALSE, but in fact it will never do so according to php_amqp_connect C function which return positive result (integer 1) only if connection established, otherwise exception thrown.

I propose to make AMQPConnection::connect method void to prevent users to make useless checks, like that one from official docs.

For backward compatibility we can't do that immediately, so for now it would nice do change just docs and stubs to reflect that the FALSE result is impossible.

Publishing to an exchange with an empty name is valid and should not throw an exception

$exchange = new \AMQPExchange($this->amqp_channel);
// or just don't bother calling setname
$exchange->setName('');
$exchange->setType(AMQP_EX_TYPE_DIRECT);
$exchange->setFlags(AMQP_PASSIVE);

$exchange->publish('msg', 'routingkey');

Results in:

Fatal error: Uncaught exception 'AMQPExchangeException' with message 'Invalid exchange name given, must be between 1 and 255 characters long.'

This exception should not be thrown as a empty exchange name is a valid exchange. Publishing to an empty name exchange results in the broker routing the message to a queue with a name that is equal to the routing key.

Segmentation fault when installing via PECL

Not sure if this is the correct place to report this, but I get a Segmentation fault when installing amqp-1.4.0beta2

[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

Last few lines of PECL install

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

running: make INSTALL_ROOT="/var/tmp/pear-build-rootye2Jud/install-amqp-1.4.0beta2" install
Installing shared extensions:     /var/tmp/pear-build-rootye2Jud/install-amqp-1.4.0beta2/usr/lib64/php/modules/
running: find "/var/tmp/pear-build-rootye2Jud/install-amqp-1.4.0beta2" | xargs ls -dils
663766   4 drwxr-xr-x. 3 root root   4096 Mar 17 09:49 /var/tmp/pear-build-rootye2Jud/install-amqp-1.4.0beta2
663800   4 drwxr-xr-x. 3 root root   4096 Mar 17 09:49 /var/tmp/pear-build-rootye2Jud/install-amqp-1.4.0beta2/usr
788331   4 drwxr-xr-x. 3 root root   4096 Mar 17 09:49 /var/tmp/pear-build-rootye2Jud/install-amqp-1.4.0beta2/usr/lib64
788332   4 drwxr-xr-x. 3 root root   4096 Mar 17 09:49 /var/tmp/pear-build-rootye2Jud/install-amqp-1.4.0beta2/usr/lib64/php
788333   4 drwxr-xr-x. 2 root root   4096 Mar 17 09:49 /var/tmp/pear-build-rootye2Jud/install-amqp-1.4.0beta2/usr/lib64/php/modules
788334 364 -rwxr-xr-x. 1 root root 371736 Mar 17 09:49 /var/tmp/pear-build-rootye2Jud/install-amqp-1.4.0beta2/usr/lib64/php/modules/amqp.so

Build process completed successfully
Installing '/usr/lib64/php/modules/amqp.so'
install ok: channel://pecl.php.net/amqp-1.4.0beta2
configuration option "php_ini" is not set to php.ini location
You should add "extension=amqp.so" to php.ini
Segmentation fault
[root@localhost ~]#

Weird behavior when using consume and autoack

Hello. I think this is a bug when using consume with AMQP_AUTOACK parameter. If there is a exception in the function that processes the messages, not only one message disappears from queue but multiple messages. I have some cases in which 5 messages disappear, some situations in which more than 5 disappear.

Switching to manual acknowledgements behaves as expected, only the message currently being processed disappears from the queue.

The version i am currently using is: 1.4.0beta2

consume(); how to break it?

Hi,

Maybe it's not an issue but is there a way to break a consume when there are no messages in a queue ? I now use pcntl_alarm but this causes Interrupted system call. is there a better way to do that ?

TODOs explanation

Can somebody give explanation for TODO file items:

  • Fix php_st_error_handling deprecation
  • Fix parameter parsing (see PECL email)
  • Add non-busy wait consumption

Release buffer on exception

https://github.com/pdezwart/php-amqp/blob/master/amqp_exchange.c#L596

In this line, if the buffer is not ok, amqp_maybe_release_buffers (https://github.com/alanxz/rabbitmq-c/blob/b852f846c46a3bb9451f99844edfbea41f3289f1/librabbitmq/amqp_connection.c#L402) will not release the buffer.

The behaviour is ok if you don't catch the exception.. but once you catch the exception, the php process still stuck due to the buffer...

Should call amqp_release_buffers directly and release the buffer instead of amqp_maybe_release_buffers ?

Bad version

Version 1.4.0beta2 reports as 1.4.0beta1.

Make Error

I am getting the following error upon attempting to invoke pecl install amqp:

/tmp/pear/temp/amqp/amqp_queue.c: In function 'parse_amqp_table': /tmp/pear/temp/amqp/amqp_queue.c:188:9: error: 'AMQP_FIELD_KIND_U64' undeclared (first use in this function) /tmp/pear/temp/amqp/amqp_queue.c:188:9: note: each undeclared identifier is reported only once for each function it appears in /tmp/pear/temp/amqp/amqp_queue.c: In function 'zim_amqp_queue_class_nack': /tmp/pear/temp/amqp/amqp_queue.c:1092:2: error: unknown type name 'amqp_basic_nack_t' /tmp/pear/temp/amqp/amqp_queue.c:1112:3: error: request for member 'delivery_tag' in something not a structure or union /tmp/pear/temp/amqp/amqp_queue.c:1113:3: error: request for member 'multiple' in something not a structure or union /tmp/pear/temp/amqp/amqp_queue.c:1114:3: error: request for member 'requeue' in something not a structure or union /tmp/pear/temp/amqp/amqp_queue.c:1119:3: error: 'AMQP_BASIC_NACK_METHOD' undeclared (first use in this function) make: *** [amqp_queue.lo] Error 1 ERROR: make' failed`

issues from bugs.php.net

There's a ridonkulous amount of open amqp bugs on bugs.php.net.
I replied to most of them, and the majority seems to be either due to outdated documentation, or bugs fixed with verision 1.0.9.

Still there are some that deserve investigating:

Is there a way to change the "bugs" link in the pecl page to point to github issues? I find the php-bugtracker awkward to use, to put it mildly.

Need to provide heartbeat option

with AMQP_HEARTBEAT == 0 in some cases the rabbitmq server doesn't close dead connections, that causes socket descriptors overflow

new download location for 1.2.0 release?

Hi,

It looks like we have tagged 1.2.0 which includes the rabbitmq-server 3.1 fix, however, I am not seeing this on pecl yet. Is there a different distribution mechanism I should be aware of?

connect_timeout has no effect

Our rabbitmq server was not responding for a while, and we found that the connect_timeout setting in AMQPConnection was not working. Instead, connect() waits for 60 seconds before failing (Socket error: could not connect to host.).

        $conn = new \AMQPConnection(array(
            'host' => $config["host"],
            'port' => 5672,
            'login' => $config["login"],
            'password' => $config["password"],
            'connect_timeout' => 1,
            'read_timeout' => 1,
            'write_timeout' => 1
        ));

A quick way to reproduce this is to set the host to an unroutable IP, like 10.255.255.1.

New release?

With the latest fixes and improvements, should we have another release?

Upgrade to RabbitMQ 3.1.0-1: AMQPConnectionException: connection closed unexpectedly

I just updated my RabbitMQ Server to Version 3.1.0-1. After that, all (except the first) of my AMQPQueue::get-Calls ran into the "connection closed unexpectedly" AMQPConnectionException. I don't know if its related to php-amqp, the rabbitmq-c library or the server itself. However, I could kind of workaround the problem by setting setPrefetchCount to 0 on the AMQPChannel.

I have shared the serverlog file here: https://gist.github.com/empi89/5508316

It would be really nice if someone who knows the deeper details of the involved software could clarify where (or if) to report the problem upstream. Thanks!

support for nested arrays in envelope headers

When reading a message from a channel, we currently only have limited support for arrays.
For example, when a message is moved to an error queue, the header structure of AMQPEnvelope contains a key 'x-death', which should contain an array with the reasons why the message ended up there.

With our current implementation there is no way to retrieve this information; header 'x-death' always gives an empty array.

The reason lies in the way we parse the values in amqp_queue.c
https://github.com/pdezwart/php-amqp/blob/master/amqp_queue.c#L354-L370

I don't think there is a limit on the nesting depth, so parsing amqp arrays into zval arrays should probably be refactored into a separate function, so we can apply it recursively.

This is more of a note about the state of things, patches highly welcome.
Anybody want to give it a shot? Instant fame and eternal gratitude guaranteed.

Avoid set qos settings on Channel constuctor.

Hi all!.

The qos settings should be setted ONLY when a queue::consume is called. For example, my web app only publish messages, whence qos settings no sense.
For resolve this issue, the channel must have a flag indicating if qos was setted or not and in the consume method of queue, it must be ensured that qos options were setted (in case that not, defaults qos settings must be setted).

https://github.com/pdezwart/php-amqp/blob/master/amqp_channel.c#L195

Regards!.

QOS

I did manage to install the library now. However, I am receiving this error:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525/amqp.so' - /usr/lib/php5/20100525/amqp.so: undefined symbol: amqp_basic_qos in Unknown on line 0

Then I get a fatal error saying that the Class 'AMQPConnection' is not found.

Problems with non existing exchanges.

  1. When you published a message in an unknown exchange, then a message in a known exchange, the second one is not published (except with a new Channel).
  2. If a new exchange is used, a Fatal Error occured when trying to get the message (even with a new Channel).

You can find a full example in this gist.

Outdated Docs on php.net/amqp

The documentation on php.net is out of date and misleading at times. How does the process of updating it work? Anything we can do to help?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.