adonis-bull icon indicating copy to clipboard operation
adonis-bull copied to clipboard

Multiple queues with same job handler

Open rumo777 opened this issue 3 years ago • 1 comments

Thank you for your work.

Correct me if I am wrong but it seems that this implementation makes 1 to 1 relation between JobContract and Queue it is running against (Adonis 5).

Here is an example of a use case: upload file and process every single line. So job would be - single line processing. All lines are added to the queue. Now I want to upload second file at the same time, but it is added to the same queue. It would be great that they had their own queues, so one could stop/pause, monitor progress of each file being processed.

I tried

export default class MyJob implements JobContract {
  constructor(key) {
     this.key = key
  }
}

So it assigns queue key on Job creation. But no luck, and digging deeper it seems that all Job classes are instantiated once and mapped to keys they have on boot.

Hope that makes sense. Maybe it is possible and I missing something.

Cheers

rumo777 avatar Mar 12 '21 18:03 rumo777

Hi @rumoru. I'll check that out, but I think you're right

HigoRibeiro avatar Mar 16 '21 12:03 HigoRibeiro