Do I need to set a queue name in the queue?

WBOY
Release: 2023-03-01 17:34:01
Original
1147 people have browsed it

The problem is this. When we push tasks to the queue, it is inevitable that the tasks pushed are diverse, such as emails, text messages, etc. When the background work process takes the tasks, our thoughts are often imprisoned, thinking that I pushed Tasks are pushed by category, so do they need to be obtained by category? Then multiple task processing processes may need to be started at this time. In fact, the only difference between them is the parameters of the task category. Isn’t this a bad design?

Reply content:

The problem is this. When we push tasks to the queue, it is inevitable that the tasks pushed are diverse, such as emails, text messages, etc. When the background work process takes the tasks, our thoughts are often imprisoned, thinking that I pushed Tasks are pushed by category, so do they need to be obtained by category? Then multiple task processing processes may need to be started at this time. In fact, the only difference between them is the parameters of the task category. Isn’t this a bad design?

Determine it based on the business scenario. If the business volume is relatively large, it is obviously not appropriate to use one process to handle the task

I still recommend using different queues to process different information. Although the parameters can be used to separate them, it is not conducive to the isolation and expansion of subsequent large concurrency. For example, a certain business only focuses on SMS information, so it monitors the SMS message queue. Yes

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!