vapor/queues

Support for setting a JobIdentifier for a job

StrauneanuDimitri opened this issue · 4 comments

Currently, there is no way to inject a JobIdentifier for a certain job using queue.dispatch(...) so that we can use that JobIdentifier to clear a job from the queue, by calling queue.clear(id).

jdmcd commented

This is an interesting idea. Perhaps the dispatch method should just return the JobIdentifier that it creates to keep it consistent. @tanner0101 what do you think?

@mcdappdev - How about passing the JobIdentifier without breaking changes? This is what I currently use (I have made a new Queue extension):

public func dispatch<J>( _ job: J.Type, _ id: JobIdentifier = JobIdentifier(), _ payload: J.Payload, maxRetryCount: Int = 0, delayUntil: Date? = nil ) -> EventLoopFuture<Void>

jdmcd commented

@StrauneanuDimitri I like that syntax, I just pushed to the PR with it :)

jdmcd commented

Merged in #64