JobProcessor

public protocol JobProcessor: class

Defines an object which can process a QueueJob of a given type. A JobProcessor instance can be assigned to any JobQueue of the same underlying QueueJob type.

  • The type of QueueJob a conforming type can process.

    Declaration

    Swift

    associatedtype JobType: QueueJob
  • Processes a job of the given type. If the job fails to process for any reason the Error must be provided.

    Declaration

    Swift

    func processJob(_ job: JobType, completion: @escaping ((JobType, Error?) -> Void))

    Parameters

    job

    The QueueJob to be processed

    completion

    The block to be called when the job has completed processing. The function must be called and should be provided the original job that was provided to the processor. If the JobProcessor fails to process the job, then the JobProcessor must provide an Error to the receiver.