Interface Job

All Superinterfaces:
com.veeva.vault.sdk.infrastructure.core.SdkEntryPoint<JobContext>

public interface Job extends com.veeva.vault.sdk.infrastructure.core.SdkEntryPoint<JobContext>
Invoked by JobService to start a Job with the Vault Java SDK.
  • Method Details

    • init

      Initializes the JobInputSupplier. The returned JobInputSupplier object contains a list of JobItems separated into smaller chunks of data called JobTasks. These JobInputSupplier objects can be retrieved through JobInitContext.newJobInput(java.lang.String).

      You cannot call this method before the job has started.

      Parameters:
      context - JobInitContext object which contains the parameters of this Job
      Returns:
      JobInputSupplier object. If a job has no input, the List in JobInputSupplier will be empty. Cannot return null.
    • process

      void process(JobProcessContext context)
      Processes the Job. Job logic is implemented inside this method. This method will run once per JobTask.

      Calls to this method may be executed in parallel across chunks, so sequence is not guaranteed. Each process call will be given a smaller chunk of data through JobProcessContext.getCurrentTask().

      You cannot call this method before calling init(JobInitContext).

      Parameters:
      context - JobProcessContext object containing the chunk of work to process
    • completeWithSuccess

      void completeWithSuccess(JobCompletionContext context)
      Contains the logic to execute for a job which completed successfully. For example, you may wish to log a "Success" message to job log file.

      This method is only called if all tasks are processed and have a TaskState of SUCCESS.

      Parameters:
      context - a JobCompletionContext object containing a JobResult object
    • completeWithError

      void completeWithError(JobCompletionContext context)
      Contains the logic to execute for a job which did not complete successfully. For example, you may wish to log a "Failure" message to job log file.

      This method is only called if all tasks are processed and one or more tasks has a TaskState of ERRORS_ENCOUNTERED.

      Parameters:
      context - a JobCompletionContext object containing a JobResult object