vapor/queues

Supplying an Application instance when dequeuing a job

Andrewangeta opened this issue · 2 comments

It would be advantageous to have access to an instance of Application when dequeueing a job.
Maybe having it added as a property on the JobContext

func dequeue(_ context: JobContext, _ payload: SomeJob) -> EventLoopFuture<Void> {
    context.application.someService.....
}

As a workaround, app.jobs.configuration has a userInfo dict that you can put whatever you need into. Then you can access that from context.configuration

Sounds good.