I have done this before.
The best solution for consistently providing these things is that at the end of job1 is job2. job1 and job2 can either go in the same queue, or in different queues, it does not matter for the sequence, it is up to you.
Any other solution, such as setting 1 + 2 queues at the same time, but a job2 message to start in 0.5 seconds will lead to race conditions, so it is not recommended.
Running job3 trigger job2 is also very easy to do.
If you need another option for this: my final suggestion would be to combine both tasks into one task and add a parameter in order to also activate the second part.
eg.
def my_job(id, etc, etc, do_job_two = false) ...job_1 stuff... if do_job_two ...job_2 stuff... end end
Tomdunning
source share