Code Monkey home page Code Monkey logo

amqphp's People

Contributors

bravesirrobin avatar cloudermaan 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

amqphp's Issues

build error with php >= 5.3.9

The phing build with latest php (5.3.9) is flawed and "generateAmqpBindings" doesn't break on these xslt processor errors.
I had to change the xsl.security_prefs setting to allow directory creation and file writes (php default is to disallow all)

[xsl]
; Write operations from within XSLT are disabled by default.
; XSL_SECPREF_CREATE_DIRECTORY | XSL_SECPREF_WRITE_NETWORK | XSL_SECPREF_WRITE_FILE = 44
; Set it to 0 to allow all operations
;xsl.security_prefs = 44

See php bug https://bugs.php.net/bug.php?id=54446 and 5.3.9 change log entry http://de.php.net/ChangeLog-5.php

Incompatibility with RabbitMQ 2.4.0 ?

I am using PHP 5.3.3 and RabbitMQ 2.4.0 and am attempting to run the demo-consumer.php file that is part of the amqphp project. Execution only gets as far as connecting before throwing an error:

$conn = new amqp\Connection($config);
$conn->connect();

OUTPUT:

PHP Fatal error:  Uncaught exception 'Exception' with message 'Invalid table key' in /srv/apps/php/lib/amqphp/amqp.wire.php:677
Stack trace:
#0 /srv/apps/php/lib/amqphp/amqp.wire.php(269): amqp_091\wire\Table->offsetSet('?', Object(amqp_091\wire\TableField))
#1 /srv/apps/php/lib/amqphp/amqp.wire.php(250): amqp_091\wire\Reader->readTable()
#2 /srv/apps/php/lib/amqphp/amqp.wire.php(269): amqp_091\wire\Reader->read('F', true)
#3 /srv/apps/php/lib/amqphp/amqp.wire.php(250): amqp_091\wire\Reader->readTable()
#4 /srv/apps/php/lib/amqphp/amqp.wire.php(893): amqp_091\wire\Reader->read('table')
#5 /srv/apps/php/lib/amqphp/amqp.wire.php(823): amqp_091\wire\Method->readMethodContent(Object(amqp_091\wire\Reader), 327)
#6 /srv/apps/php/lib/amqphp/amqp.php(431): amqp_091\wire\Method->readConstruct(Object(amqp_091\wire\Reader))
#7 /srv/apps/php/consumer.php(43): amqp_091\Connection->connect()
#8 {main}
  thrown in /srv/apps/php/lib/amqphp/amqp.wire.php on line 677

Incomplete support for 'headers' publish parameter serialization

I'm sorry I cannot propose a patch... still, if I try to publish a message with a set of headers as in:

$p = ...
$publisher = $chan->basic('publish', $p);
$publisher->setContent('text content');
$chan->invoke($publisher);

$p = @array('routing_key' => 'key',
                       'headers' => @array('hdr1' => 'v')
                       ) // v gets published as an integer with value 374

$p = @array(routing_key' => 'key',
                       'headers' => @array('hdr1' => @array( 'hdr2' => 'v'))
                      ) // the inner @array becomes "true" at the broker


$p = @array('routing_key' => 'key',
                       'headers' => @array('hdr1' => 'val1')
                      ) // re-throws an exception, seemingly originated at the broker:

   // Fatal error:  Uncaught exception 'Exception' with message 
   // '[connection.close] reply-code=INTERNAL_ERROR triggered by 
   // (Unknown or unspecified): (reply-code=541) (reply-text=INTERNAL_ERROR)
   // (class-id=0) (method-id=0)  Connection closed OK'

$p = @array('routing_key' => 'key',
                       'headers' => @array('hdr1' => 12)
                      ) // re-throws the very same exception

I don't understand where should I look to find the serialization/deserialization code.
If you don't mind pointing me in the right way, and think I can be of any help, even though
I'm not a php5 man, I could try and take a stab at the table serialization myself.

Thank you very much, yours
l.

Problem with multibyte encoding and mbstring.func_overload setting

Under some PHP mbstring settings the library doesn't work.

To reproduce it you can for example set these settings

mbstring.internal_encoding => UTF-8
mbstring.func_overload => 2

This is because AMQP is a binary protocol and these settings override strlen to act as mb_strlen with the given default encoding.

Do you think this problem could be solved inside the library?

Thank you

ha-policy and ha-params not supported as queue.declare fields

The policy params used by new versions of rabbit throw warnings when included as such:

(code has been abbreviated)

$params = array('ha-policy' => 'all');
$method = $this->defaultChannel->queue('declare', $params);
$this->connection->invoke($method);

That throws a warning, but DOES work when sent to Rabbit. Adding the policy in the attributes gets set in the queue parameter list, not policy. ie:

$params = array('arguments' => array('ha-policy' => 'all'));
$method = $this->defaultChannel->queue('declare', $params);
$this->connection->invoke($method);

This does not throw a warning, but DOES NOT work for setting policy. It's very possible im doing something wrong to properly send the policy information to Rabbit, what is the proper way?

SSL Support

Hello
Does your library support SSL connections?

Windows compatibility

How can one make a long-running consumer on Windows, since it does not support the pcntl functions?

Bug when connecting to multiple vhosts on the same server using persistent connection

Hi,

We have found the following error when implementing support for you library.

Uncaught exception 'Exception' with message 'Failed to reload amqp connection cache during wakeup' in /mnt/user/libs/external/amqphp/src/amqphp/persistent/PConnection.php:318
Stack trace:
#0 /mnt/user/libs/external/amqphp/src/amqphp/persistent/PConnection.php(131): amqphp\persistent\PConnection->wakeup()
#1 /mnt/user/web/engine/MQ.class.php(241): amqphp\persistent\PConnection->connect()

How to reproduce?

  • Use persistent connection when connecting to the message queue broker
new \amqphp\persistent\PConnection( array(
    'socketParams' => array(
        'url' => 'tcp://' . $connection['host'] . ':' . $connection['port'],
    ),
    'username' => $connection['user'],
    'userpass' => $connection['password'],
    'vhost' => $connection['vhost'],
) );

self::$connection_pool[$key]->pHelperImpl = '\\amqphp\\persistent\\APCPersistenceHelper';
self::$connection_pool[$key]->connect();
  • Connect to vhost1 on server1
  • After the connection is set up for vhost1, connect to vhost2 on server1 (the same server)

The cause

We have seen that the problem is caused by different caching patterns when persisting inter-request data:

  • when creating persistent sockets (with stream_socket_client using STREAM_CLIENT_PERSISTENT flag) the OS persists the connection per url (protocol+hostname+port)
  • when persisting connection info for sockets (channels, other amqp-related connection info) the library per url (protocol+hostname+port) AND vhost

When connecting to the 2ns vhost, the library first creates the socket, which has the same URL so it will be reused. This means that its internal pointer (ftell) is bigger than 0, so the library supposes that it's a reused connection (correct) and tries to load the data for it. The problem is that the cache key for the connection data is different (the vhost has changed), so it can't find it.

We are happy to help in fixing this by creating a pull request, I just wanted to consult about solutions to see if there is anything you prefer.

I was thinking to change to cache key (getCK) of the socket excluding the vhost. This, however, causes problems in other parts of the library (Stream socket connection created a new wrapper object for an existing persistent connection on URL ...). Alternatively we can generate the cache key for the persistence helper outside the socket class, or inside with a new method.

What do you think?

Full support for basic commands in amqp 0.9.1

Just started using the library, so just let me know if I'm out of line :). I'm using rabbitmq 2.4.1 on Ubuntu server 10.04.

It looks like you can just send basic commands using $ch->invoke, but it looks like there isn't support for all 0.9.1 basic commands (as documented here - http://www.rabbitmq.com/amqp-0-9-1-quickref.html); purge and delete being 2 examples.

Is there support for these commands or am I just missing something ? If not, any timeline as to when they might get implemented ?

connection issues

Hello, Im having some issues trying to connect to rabbitmq on freebsd
client side error(after enabled the debug):

00000000 Fatal error: Uncaught exception 'Exception' with message 'Connection initialisation failed (2)' in C:...\BraveSirRobin-amqphp-9e465b9 \amqphp\Connection.php on line 184

Exception: Connection initialisation failed (2) in C:...\BraveSirRobin-amqphp-9e465b9\amqphp\Connection.php on line 184

server side info:
=INFO REPORT==== 28-Apr-2011::16:10:38 ===
accepted TCP connection on 0.0.0.0:5672 from ...:60320

=INFO REPORT==== 28-Apr-2011::16:10:38 ===
starting TCP connection <0.22516.0> from ...:60320

=ERROR REPORT==== 28-Apr-2011::16:10:48 ===
exception on TCP connection <0.22516.0> from ...:60320
{handshake_timeout,frame_header}

=INFO REPORT==== 28-Apr-2011::16:10:48 ===
closing TCP connection <0.22516.0> from ...:60320

Im using php 5.3.6 on client (windows)
rabbitmq-2.3.1 on freebsd 8.2 stable
i use user with password and vhost(who i pass to Connection constructor), im sure that user does exist and has password set and all permissions are right on that vhost, but it seems client never goes up to auth stage.

Problem with channel ack

Sorry me agian - this time with a documentation and logic problem within a channel/consumer ack. The docs state:

\amqphp\CONSUMER_ACK - this const is a signal to the Channel to respond with basic.ack (multiple=false)

but this is not the case: https://github.com/BraveSirRobin/amqphp/blob/master/src/amqphp/Channel.php#L406 - so looks like all acks will be send with multiple=true, which makes it impossible to only ack particular messages and leave messages 'unacknowledged' (.. for whatever)

btw - I think It would be a good idea to note something about the channel ackBuffer in the consumer docs - it took me some time to figure out why the channel was not sending any acks while I was playing with a single message g

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.