In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
2025-11-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "how laravel uses RabbitMQ". In daily operation, I believe many people have doubts about how to use RabbitMQ in laravel. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how laravel uses RabbitMQ". Next, please follow the editor to study!
Homestead (ubuntu) + Laravel use RabbitMQ usage 1: use laravel-queue-rabbitmq alone
Laravel installation RabbitMQ:
First of all, pay attention to the laravel version information supported by your laravel-queue-rabbitmq:
Package VersionLaravel VersionBug Fixes Until
96October 5th, 2021Documentation106, 7October 5th, 2021Documentation118April 6th, 2021Documentation
Execute the installation command:
Composer require vladimir-yuldashev/laravel-queue-rabbitmq
Wait for the installation to complete and add to config/queue.php:
'connections' = > [/ /... 'rabbitmq' = > [' driver' = > 'rabbitmq',' queue' = > env ('RABBITMQ_QUEUE',' default'), 'connection' = > PhpAmqpLib\ Connection\ AMQPLazyConnection::class,' hosts' = > ['host' = > env (' RABBITMQ_HOST', '127.0.0.1'), 'port' = > env (' RABBITMQ_PORT', 5672) 'user' = > env (' RABBITMQ_USER', 'guest'),' password' = > env ('RABBITMQ_PASSWORD',' guest'), 'vhost' = > env (' RABBITMQ_VHOST','/'),], 'options' = > [' ssl_options' = > ['cafile' = > env (' RABBITMQ_SSL_CAFILE', null) 'local_cert' = > env (' RABBITMQ_SSL_LOCALCERT', null), 'local_key' = > env (' RABBITMQ_SSL_LOCALKEY', null), 'verify_peer' = > env (' RABBITMQ_SSL_VERIFY_PEER', true), 'passphrase' = > env (' RABBITMQ_SSL_PASSPHRASE', null),] 'queue' = > [' job' = > VladimirYuldashev\ LaravelQueueRabbitMQ\ Queue\ Jobs\ RabbitMQJob::class,],], / * * Set to "horizon" if you wish to use Laravel Horizon. * / 'worker' = > env (' RABBITMQ_WORKER', 'default'),], / /...]
And modify it in config/queue.php:
/ / change sync to rabbitmq, and use redis driver to change to redis'default' = > env ('QUEUE_CONNECTION',' sync'), 'default' = > env (' QUEUE_CONNECTION', 'rabbitmq'), or modify QUEUE_CONNECTION=rabbitmqQUEUE_CONNECTION=rabbitmq under .env
Execute the command to generate the task class:
Php artisan make:job TestQueue
Modify the TestQueue.php code:
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.