Interface TypedEventWriter
- All Known Subinterfaces:
StateWriter
-
Method Summary
Modifier and TypeMethodDescriptionvoid
appendFollowUpEvent
(long key, Intent intent, RecordValue value) Append a follow up event to the result builder.void
appendFollowUpEvent
(long key, Intent intent, RecordValue value, int recordVersion) Append a specific version of a follow up event to the result builder.boolean
canWriteEventOfLength
(int eventLength) Use this to know whether you can write an event of this length.
-
Method Details
-
appendFollowUpEvent
Append a follow up event to the result builder.Different versions of event records may be applied by different
EventApplier
s, leading to differing state changes. This allows fixing bugs in event appliers because every event applier must produce the same state changes for an event both when writing it and when replaying it, even on newer versions of Zeebe.This method always uses the latest available
EventApplier
. If a specific needs to be used, consider usingappendFollowUpEvent(long, Intent, RecordValue, int)
instead.- Parameters:
key
- the key of the eventintent
- the intent of the eventvalue
- the record of the event- Throws:
ExceededBatchRecordSizeException
- if the appended event doesn't fit into the RecordBatch
-
appendFollowUpEvent
Append a specific version of a follow up event to the result builder.Different versions of event records may be applied by different
EventApplier
s, leading to differing state changes. This allows fixing bugs in event appliers because every event applier must produce the same state changes for an event both when writing it and when replaying it, even on newer versions of Zeebe.- Parameters:
key
- the key of the eventintent
- the intent of the eventvalue
- the record of the eventrecordVersion
- the version of the record of the event- Throws:
ExceededBatchRecordSizeException
- if the appended event doesn't fit into the RecordBatch
-
canWriteEventOfLength
boolean canWriteEventOfLength(int eventLength) Use this to know whether you can write an event of this length.Example:
final TypedEventWriter writer; // ... assign the writer final TypedRecord<?> record; // ... assign record if (!writer.canWriteEventOfLength(record.getLength())) { // raise an incident or some such return; }
- Parameters:
eventLength
- the length of the event that will be written- Returns:
- true if an event of length
eventLength
can be written
-