How can I run all jobs in a chain on the same queue worker?

How can I run all jobs in a chain on the same queue worker in Laravel?

I’m using Laravel with Horizon and I’m dispatching jobs to a queue using withChain. I have multiple workers running with Horizon and those jobs are done in order, but by different servers. This is a problem, because jobs later down the chain require files that are produced by jobs up the chain.

Is there any way I can have all jobs run on the same worker one after the other? I don’t want to upload the files and download them again for communicating between the jobs because those file sizes can be big.

I could probably just turn it into one big job, but I’m wondering if there is a more elegant way.

Source: Laravel