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 TypeMethodDescriptionvoidcompleteWithError(JobCompletionContext context) Contains the logic to execute for a job which did not complete successfully.voidcompleteWithSuccess(JobCompletionContext context) Contains the logic to execute for a job which completed successfully.init(JobInitContext context) Initializes theJobInputSupplier.voidprocess(JobProcessContext context) Processes theJob.
-
Method Details
-
init
Initializes theJobInputSupplier. The returnedJobInputSupplierobject contains a list ofJobItemsseparated into smaller chunks of data calledJobTasks. TheseJobInputSupplierobjects 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-JobProcessContextobject 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
TaskStateofSUCCESS.- Parameters:
context- aJobCompletionContextobject containing aJobResultobject
-
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
TaskStateofERRORS_ENCOUNTERED.- Parameters:
context- aJobCompletionContextobject containing aJobResultobject
-