Package com.veeva.vault.sdk.api.job
Interface Job
- All Superinterfaces:
com.veeva.vault.sdk.infrastructure.core.SdkEntryPoint<JobContext>
Invoked by
JobService
to start a Job with the Vault Java SDK.-
Method Summary
Modifier and TypeMethodDescriptionvoid
completeWithError
(JobCompletionContext context) Contains the logic to execute for a job which did not complete successfully.void
completeWithSuccess
(JobCompletionContext context) Contains the logic to execute for a job which completed successfully.init
(JobInitContext context) Initializes theJobInputSupplier
.void
process
(JobProcessContext context) Processes theJob
.
-
Method Details
-
init
Initializes theJobInputSupplier
. The returnedJobInputSupplier
object contains a list ofJobItems
separated into smaller chunks of data calledJobTasks
. TheseJobInputSupplier
objects can be retrieved throughJobInitContext.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
Processes theJob
. Job logic is implemented inside this method. This method will run once perJobTask
.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
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
ofSUCCESS
.- Parameters:
context
- aJobCompletionContext
object containing aJobResult
object
-
completeWithError
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
ofERRORS_ENCOUNTERED
.- Parameters:
context
- aJobCompletionContext
object containing aJobResult
object
-