DEV Community

Discussion on: Task queues and why do we need them.

Collapse
 
anduser96 profile image
Andrei Gatej

Thank you for the article! It was a great read.

I have a small question, though. Referring to the diagram, does it means that the server is a publisher, but also a sort of consumer? Because it publishes some tasks, but then it acts as a consumer when the worker has finished the work and pushes the result back into the queue, where the server will take care of it. Is this correct?

Thank you!

Collapse
 
sarbikbetal profile image
Sarbik Betal • Edited

Yes Andrei you can think of it that way, if you look closely you will notice there are two kinds of data flow happening here, one is the actual task and other is the event. Different kinds of events are emitted related to the task (task queued, task succeeded, task failed, task stalled. etc). So the server acts as the publisher of the actual task and consumer of those task events that are published by the worker. Hope it helps clear your doubt 😄.

Collapse
 
anduser96 profile image
Andrei Gatej

Makes perfect sense! Thank you very much