Вопрос

I'm using SlmQueue (or will be), and I'm trying to decide whether it's best to have the jobs re-schedule themselves, spawn new jobs, etc. (using QueueAwareInterface) or if it's better for each job to have a shared service as a dependency, and for that service to manage the re-queueing/spawning of jobs, etc.

Are there any pros and cons for either method?

Это было полезно?

Решение

As author of SlmQueue I developed the QueueAwareInterface to be more flexible in requeueing jobs. However, you create a coupling between jobs and queues you might not want.

It's up to you :) But I don't really mind that jobs can push themselves again in the queue. If you are bothered about separation of concerns, you might want to create a service which does the job pushing. You can use that service in both your controllers (for pushing the job a first time) and in your jobs (to push them again when failed).

However, for me that's too much abstraction for a simple goal and I'd personally use the QueueAwareInterface :)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top