bschmitt / laravel-amqp

AMQP wrapper for Laravel and Lumen to publish and consume messages
MIT License
270 stars 86 forks source link

routing and listen #19

Open anedisi opened 8 years ago

anedisi commented 8 years ago

Consumer right now does not make to much sense for my use case. When im publishing new things i publish it to routing key.

i would like some API like this Amqp::listen('routing.key,other.key', callback)

this would generate new queue behind the scenes and consume those routing keys. with current setup i have to create new queue for every routing key and bind it to that routing key.

Also i needed the RPC so im implementing it.

i have something like this. $response = Amqp::rpc('routing.key');

and for a rpc listener the consumer/listener could be the same as in publish with a difference where in callback we would call something like $resolver->replay(...

right now i have forked and playing with it to suit my needs but i would like if we can implement something like this here so i dont have to keep a local copy of this i my project.

bschmitt commented 8 years ago

Sorry for the late reply, was on vacation.

Not sure if I understood it correctly, do you want to create a queue which contains messages of multiple routing keys?

Regarding the RPC, I've already played around with it but hadn't time to merge it into the repo.

anedisi commented 8 years ago

yes i wanted to bind a queue to multiple routing keys. that was fairly easy to implement. also the ability to "subscribe" to some routing keys.

i have created the "listener". the listener is basically this https://www.rabbitmq.com/tutorials/tutorial-five-python.html

sorry i have already implemented those and rpc in my project.

souzavitor commented 7 years ago

I think it would be nice to create a way to consume more than one "routing_key".

Something like this:

Amqp::listen(
    ['routing-warning-log', 'routing-error-log'],
    $callback
);

We can find some examples here: https://www.rabbitmq.com/tutorials/tutorial-four-php.html https://www.rabbitmq.com/tutorials/tutorial-five-php.html

aqkhan commented 6 years ago

Have you added RPC support ?

stevenklar commented 6 years ago

@aqkhan #9