Redis-based customized delay time
Last updated
Last updated
Delay queue: A list of ordered queues which store all delayed/reserved jobs (only stores job Id)
Scan delay bucket and put expired jobs into ready queue
Ready queue: A list of ordered queues which store jobs in Ready state.
Topic: The same category of job collections
It will poll the delay queue and move items to the corresponding topic within ready queues if the tasks are ready.
Worker: Workers use BLPOP on the ready queue and process the message. Once done, the response could be put in a response queue and send to consumer.
JobPool: Store all metadata about jobs
Stores as key value pairs. Key is job id and value is job struct.
Job struct contains the following:
topic: job category. Needed because each category will has its own callback function.
id: job unique identifier
delayTime: time to delay before executing the task
ttr: timeout duration for this job to be executed
body: job content
callback: http url for calling a specific function