Package io.camunda.zeebe.engine
Class Engine
java.lang.Object
io.camunda.zeebe.engine.Engine
- All Implemented Interfaces:
RecordProcessor
-
Constructor Summary
ConstructorsConstructorDescriptionEngine(TypedRecordProcessorFactory typedRecordProcessorFactory, EngineConfiguration config) -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true if the processor is responsible for processing a record with the given valueType.voidinit(RecordProcessorContext recordProcessorContext) Called by platform to initialize the processoronProcessingError(Throwable processingException, TypedRecord record, ProcessingResultBuilder processingResultBuilder) Called by platform when a processing error occurred.process(TypedRecord record, ProcessingResultBuilder processingResultBuilder) Called by platform to process a single record.voidreplay(TypedRecord event) Called by platform in order to replay a single record
-
Constructor Details
-
Engine
-
-
Method Details
-
init
Description copied from interface:RecordProcessorCalled by platform to initialize the processor- Specified by:
initin interfaceRecordProcessor- Parameters:
recordProcessorContext- context object to initialize the processor
-
accepts
Description copied from interface:RecordProcessorReturns true if the processor is responsible for processing a record with the given valueType. If it returns true, thenRecordProcessor.process(TypedRecord, ProcessingResultBuilder)andRecordProcessor.replay(TypedRecord)must successfully process or replay the record with the given valueType. The processor can also choose to skip the record depending on the intent of the record.If it returns false,
RecordProcessor.process(TypedRecord, ProcessingResultBuilder)* andRecordProcessor.replay(TypedRecord)with the given valueType will not be called.- Specified by:
acceptsin interfaceRecordProcessor- Parameters:
valueType- valueType of a record- Returns:
- true or false
-
replay
Description copied from interface:RecordProcessorCalled by platform in order to replay a single recordContract
- Record will be an event
- Will be called before processing is called
- Implementors can write to the database. Transaction is provided by platform, which also takes care of lifecycle of the transaction
- Implementors must not write to the log stream
- Implementors must not schedule post commit tasks
- Specified by:
replayin interfaceRecordProcessor- Parameters:
event- the record to replay
-
process
public ProcessingResult process(TypedRecord record, ProcessingResultBuilder processingResultBuilder) Description copied from interface:RecordProcessorCalled by platform to process a single record.Contract
- Record will be a command
- Will be called after replay is called
- Implementors can write to the database. Transaction is provided by platform, which also takes care of lifecycle of the transaction
- Implementors must ensure that if they generate follow up events, these are applied to the database while this method is called
- Implementors can produce follow up commands and events, client responses and on commit
tasks via
processingResultBuilder - Implementors can indicate that the record should be skipped by returning
EmptyProcessingResult.INSTANCE
- Specified by:
processin interfaceRecordProcessor- Returns:
- the result of the processing; must be generated via
processingResultBuilder.build()
-
onProcessingError
public ProcessingResult onProcessingError(Throwable processingException, TypedRecord record, ProcessingResultBuilder processingResultBuilder) Description copied from interface:RecordProcessorCalled by platform when a processing error occurred.Contract
- Record will be a command
- Will be called if an uncaught exception is thrown in
RecordProcessor.process(TypedRecord, ProcessingResultBuilder), or when an uncaught exception is thrown by the ProcessingStateMachine while committing the transaction - Implementors can write to the database. Transaction is provided by platform, which also takes care of lifecycle of the transaction
- Implementors must ensure that if they generate follow up events, these are applied to the database while this method is called
- Implementors can produce follow up commands, events and rejections, client responses and
on commit tasks via
processingResultBuilder - Implementors are responsible for error logging when needed
- Specified by:
onProcessingErrorin interfaceRecordProcessor- Returns:
- the result of the processing; must be generated via
ProcessingResultBuilder processingResultBuilder
-