Package io.camunda.zeebe.engine.api
Interface ProcessingResultBuilder
public interface ProcessingResultBuilder
Builder to compose the processing result
-
Method Summary
Modifier and TypeMethodDescriptionAppends a task to be executed after a successful commit ProcessingResultBuilder (replacement for side effects)default ProcessingResultBuilder
appendRecord
(long key, RecordType type, Intent intent, RejectionType rejectionType, String rejectionReason, RecordValue value) Appends a record to the resultappendRecordReturnEither
(long key, RecordType type, Intent intent, RejectionType rejectionType, String rejectionReason, RecordValue value) Appends a record to the result, returns anEither<RuntimeException,
which indicates whether the appending was successful or not.ProcessingResultBuilder> build()
boolean
canWriteEventOfLength
(int eventLength) Resets itself with the post commit tasks resetwithResponse
(RecordType type, long key, Intent intent, UnpackedObject value, ValueType valueType, RejectionType rejectionType, String rejectionReason, long requestId, int requestStreamId) Sets the response for the result; will be overwritten if called more than once
-
Method Details
-
appendRecord
default ProcessingResultBuilder appendRecord(long key, RecordType type, Intent intent, RejectionType rejectionType, String rejectionReason, RecordValue value) throws RuntimeException Appends a record to the result- Returns:
- returns itself for method chaining
- Throws:
RecordBatch.ExceededBatchRecordSizeException
- if the appended record doesn't fit into the RecordBatchRuntimeException
-
appendRecordReturnEither
Either<RuntimeException,ProcessingResultBuilder> appendRecordReturnEither(long key, RecordType type, Intent intent, RejectionType rejectionType, String rejectionReason, RecordValue value) Appends a record to the result, returns anEither<RuntimeException,
which indicates whether the appending was successful or not. This is useful in case were potentially we could reach the record batch limit size. The return either allows to handle such error case gracefully.ProcessingResultBuilder> - Returns:
- returns either a failure or itself for chaining
-
withResponse
ProcessingResultBuilder withResponse(RecordType type, long key, Intent intent, UnpackedObject value, ValueType valueType, RejectionType rejectionType, String rejectionReason, long requestId, int requestStreamId) Sets the response for the result; will be overwritten if called more than once- Returns:
- returns itself for method chaining
-
appendPostCommitTask
Appends a task to be executed after a successful commit ProcessingResultBuilder (replacement for side effects)- Returns:
- returns itself for method chaining
-
resetPostCommitTasks
ProcessingResultBuilder resetPostCommitTasks()Resets itself with the post commit tasks reset- Returns:
- itself for method chaining
-
build
ProcessingResult build() -
canWriteEventOfLength
boolean canWriteEventOfLength(int eventLength)
-