S
- type of object a success is represented asE
- type of object an error is represented aspublic interface BatchOperation<S,E>
execute()
.
Specifying a success-handler via the onSuccesses(Consumer)
method
is optional, but specifying an error-handling strategy is required.
The execute()
method will quickly fail if there is no error-handling strategy.
Modifier and Type | Method and Description |
---|---|
void |
execute()
Executes the batch operation.
|
BatchOperation<S,E> |
ignoreErrors()
Indicates errors are ignored during execution.
|
BatchOperation<S,E> |
onErrors(Consumer<List<E>> errorsHandler)
A function called during execution if there is at least one error in the batch.
|
BatchOperation<S,E> |
onSuccesses(Consumer<List<S>> successesHandler)
A function called during execution if there is at least one success in the batch.
|
BatchOperation<S,E> |
rollbackOnErrors()
A convenience method to throw a runtime exception
if at least one error occurs during execution.
|
BatchOperation<S,E> onSuccesses(Consumer<List<S>> successesHandler)
successesHandler
- function to call during execution
if there is at least one success in the batchBatchOperation<S,E> onErrors(Consumer<List<E>> errorsHandler)
errorsHandler
- function to call during execution
if there is at least one error in the batchBatchOperation<S,E> ignoreErrors()
BatchOperation<S,E> rollbackOnErrors()
If you want anything other than this
default behavior, use the onErrors(Consumer)
method.
void execute()
RuntimeException
.RuntimeException
- if the operation is not completely specified.
Specifically, the case that no error-handling behavior has been specified.Copyright © Veeva Systems 2017–2021. All rights reserved.