bschmitt / laravel-amqp

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

How do I use the topic pattern #76

Closed kbdxbt closed 4 years ago

kbdxbt commented 4 years ago

hello,I had a problem using this package

My question is that I want to use rabbitmq through topic mode. I use the mode of matching routes, but it has no effect. May I ask how I should use it or do you have any examples for reference?

Amqp::publish('fruit.red', 'message2' , [ 'exchange_type' => 'topic', 'exchange' => 'test.topick', ]);

Amqp::consume('red.queue', function ($message, $resolver) { var_dump($message->body); $resolver->acknowledge($message); }, [ 'routing' => '*.red', 'exchange' => 'test.topic', 'exchange_type' => 'topic', 'persistent' => true // required if you want to listen forever ]);