Class StreamRecord<T>

java.lang.Object
com.avoka.fc.core.stream.StreamRecord<T>
Type Parameters:
T - the type of the value in the record

public class StreamRecord<T> extends Object
Provide a record in a stream, containing topic, key, value, partition, and offset information.
Since:
24.4.0
  • Constructor Details

    • StreamRecord

      public StreamRecord(String topic, String partition, String key, T value)
      Constructs a stream record with the given topic, key, and value.
      Parameters:
      topic - the topic of the record
      key - the key of the record
      value - the value of the record
    • StreamRecord

      public StreamRecord(String topic, Integer partition, String key, T value)
      Constructs a stream record with the given topic, partition, key, and value.
      Parameters:
      topic - the topic of the record
      partition - the partition of the record
      key - the key of the record
      value - the value of the record
  • Method Details

    • toString

      public static String toString(List<StreamRecord<?>> records)
      Converts a list of stream records into a string representation.
      Parameters:
      records - the list of stream records
      Returns:
      the string representation of the records
    • getKey

      public String getKey()
      Retrieves the key of the record.
      Returns:
      the key of the record
    • getValue

      public T getValue()
      Retrieves the value of the record.
      Returns:
      the value of the record
    • getPartition

      public String getPartition()
      Retrieves the partition of the record.
      Returns:
      the partition of the record
    • getTopic

      public String getTopic()
      Retrieves the topic of the partition.
      Returns:
      the topic of the partition
    • getOffset

      public String getOffset()
      Retrieves the offset of the record.
      Returns:
      the offset of the record
    • setOffset

      public StreamRecord<T> setOffset(Long offset)
      Sets the offset of the record.
      Parameters:
      offset - the offset to set
      Returns:
      the updated stream record
    • setOffset

      public StreamRecord<T> setOffset(String offset)
      Sets the offset of the record.
      Parameters:
      offset - the offset to set
      Returns:
      the updated stream record
    • toString

      public String toString()
      Retrieves the string representation of the stream record.
      Overrides:
      toString in class Object
      Returns:
      the string representation of the stream record