Home  >  Article  >  Backend Development  >  Do I need to set a queue name in the queue?

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

WBOY
WBOYOriginal
2016-12-01 00:25:411148browse

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

Statement:
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