Class CommandProcessorImpl<T extends UnifiedRecordValue>
java.lang.Object
io.camunda.zeebe.engine.processing.streamprocessor.CommandProcessorImpl<T>
- Type Parameters:
T
- the record value type
- All Implemented Interfaces:
CommandProcessor.CommandControl<T>
,TypedRecordProcessor<T>
public final class CommandProcessorImpl<T extends UnifiedRecordValue>
extends Object
implements TypedRecordProcessor<T>, CommandProcessor.CommandControl<T>
Decorates a command processor with simple accept and reject logic.
On accept it writes the state corresponding to successfully processing the command (e.g. process instance creation: CREATE => CREATED); and responds if it was a client command that should be responded to.
On reject it writes a command rejection
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.camunda.zeebe.engine.processing.streamprocessor.TypedRecordProcessor
TypedRecordProcessor.ProcessingError
-
Constructor Summary
ConstructorsConstructorDescriptionCommandProcessorImpl
(CommandProcessor<T> commandProcessor, KeyGenerator keyGenerator, Writers writers) -
Method Summary
Modifier and TypeMethodDescriptionlong
void
processRecord
(TypedRecord<T> command) void
reject
(RejectionType type, String reason) tryHandleError
(TypedRecord<T> command, Throwable error) Try to handle an error that occurred during processing.
-
Constructor Details
-
CommandProcessorImpl
public CommandProcessorImpl(CommandProcessor<T> commandProcessor, KeyGenerator keyGenerator, Writers writers)
-
-
Method Details
-
processRecord
- Specified by:
processRecord
in interfaceTypedRecordProcessor<T extends UnifiedRecordValue>
-
tryHandleError
Description copied from interface:TypedRecordProcessor
Try to handle an error that occurred during processing.- Specified by:
tryHandleError
in interfaceTypedRecordProcessor<T extends UnifiedRecordValue>
- Parameters:
command
- The command that was being processed when the error occurrederror
- The error that occurred, and the processor should attempt to handle- Returns:
- The type of the processing error. Default:
TypedRecordProcessor.ProcessingError.UNEXPECTED_ERROR
.
-
accept
- Specified by:
accept
in interfaceCommandProcessor.CommandControl<T extends UnifiedRecordValue>
- Returns:
- the key of the entity
-
reject
- Specified by:
reject
in interfaceCommandProcessor.CommandControl<T extends UnifiedRecordValue>
-