Open priyadarshiniMuthuraman opened 5 years ago
Create a laravel artisan command and start to consume. You will of course need to run the command and handle the keep alive yourself. This library does not provide you with any boilerplate for this.
@stevenklar Hey, how you doing? You can show us an example, I’ve read several forums and still can’t consume a queue of an api other than a standard api. :(
@Lincolnbiancard +1
First create a command as described here: https://laravel.com/docs/8.x/artisan#command-structure Then register the command as described here: https://laravel.com/docs/8.x/artisan#registering-commands
Inside the handle method of the command please put the code from above:
Amqp::consume('queue-name', function ($message, $resolver) {
var_dump($message->body);
$resolver->acknowledge($message);
});
Hi,
I am using this package to publish and consume the message using RabbitMQ in a Microservices based application. I am publishing the message in service and trying to consume the same in another service.
The documentation is pretty clear on the code to consume the published message in the queue. However, in the traditional Laravel queue process, we would describe the process to be performed inside the handle() method. And call the
php artisan queue:work
command to execute the queue.But here in the documentation, the code is clear to consume the message but How to consume the message and execute the same with an artisan command is confusing.
where would I write the code below code in Laravel application and listen to it in production server: