All Known Subinterfaces:
StateWriter

public interface TypedEventWriter
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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

      void appendFollowUpEvent(long key, Intent intent, RecordValue value)
      Append a follow up event to the result builder.

      Different versions of event records may be applied by different EventAppliers, 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 using appendFollowUpEvent(long, Intent, RecordValue, int) instead.

      Parameters:
      key - the key of the event
      intent - the intent of the event
      value - the record of the event
      Throws:
      ExceededBatchRecordSizeException - if the appended event doesn't fit into the RecordBatch
    • appendFollowUpEvent

      void appendFollowUpEvent(long key, Intent intent, RecordValue value, int recordVersion)
      Append a specific version of a follow up event to the result builder.

      Different versions of event records may be applied by different EventAppliers, 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 event
      intent - the intent of the event
      value - the record of the event
      recordVersion - 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