Package io.camunda.zeebe.engine.api
Interface RecordProcessor<CONTEXT>
- All Known Implementing Classes:
Engine
public interface RecordProcessor<CONTEXT>
Interface for record processors. A record processor is responsible for handling a single record.
(The class
StreamProcessor in turn is responsible for handling a stream of records.-
Method Summary
Modifier and TypeMethodDescriptionvoidCalled by platform to initialize the processoronProcessingError(Throwable processingException, TypedRecord record, ProcessingResultBuilder processingResultBuilder) Called by platform when a processing error occurredprocess(TypedRecord record, ProcessingResultBuilder processingResultBuilder) Called by platform to process a single recordvoidreplay(TypedRecord record) Called by platform in order to replay a single record
-
Method Details
-
init
Called by platform to initialize the processor- Parameters:
recordProcessorContext- context object to initialize the processor
-
replay
Called 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
- Parameters:
record- the record to replay
-
process
Called by platform to process a single recordContract * *
-
*
- 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
- Returns:
- the result of the processing; must be generated via
processingResultBuilder.build()
-
onProcessingError
ProcessingResult onProcessingError(Throwable processingException, TypedRecord record, ProcessingResultBuilder processingResultBuilder) Called by platform when a processing error occurred- Returns:
- the result of the processing; must be generated via
ProcessingResultBuilder processingResultBuilder
-