Class PojoConsumerRecordToTableWriterAdapter.Builder

java.lang.Object
io.deephaven.kafka.ingest.PojoConsumerRecordToTableWriterAdapter.Builder
Enclosing class:
PojoConsumerRecordToTableWriterAdapter<K,V>

public static class PojoConsumerRecordToTableWriterAdapter.Builder extends Object
A builder for the PojoConsumerRecordToTableWriterAdapter.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • offsetColumnName

      @ScriptApi @NotNull public PojoConsumerRecordToTableWriterAdapter.Builder offsetColumnName(@NotNull String offsetColumnName)
      Set the name of the column which stores the Kafka offset of the record.
      Parameters:
      offsetColumnName - the name of the column in the output table
      Returns:
      this builder
    • recvTimeColumnName

      @ScriptApi @NotNull public PojoConsumerRecordToTableWriterAdapter.Builder recvTimeColumnName(@NotNull String recvTimeColumnName)
      Set the name of the column which stores the time that the record was received by the ingester.
      Parameters:
      recvTimeColumnName - the name of the column in the output table
      Returns:
      this builder
    • timestampColumnName

      @ScriptApi @NotNull public PojoConsumerRecordToTableWriterAdapter.Builder timestampColumnName(@NotNull String timestampColumnName)
      Set the name of the column which stores the Kafka timestamp of the record.
      Parameters:
      timestampColumnName - the name of the column in the output table
      Returns:
      this builder
    • kafkaPartitionColumnName

      @ScriptApi @NotNull public PojoConsumerRecordToTableWriterAdapter.Builder kafkaPartitionColumnName(@NotNull String kafkaPartitionColumnName)
      Set the name of the column which stores the Kafka partition identifier of the record.
      Parameters:
      kafkaPartitionColumnName - the name of the column in the output table
      Returns:
      this builder
    • keyClass

      @ScriptApi @NotNull public PojoConsumerRecordToTableWriterAdapter.Builder keyClass(@NotNull Class<?> keyClass)
      Set the class to use for deserialized keys.
      Parameters:
      keyClass - the class for deserialized keys
      Returns:
      this builder
    • valueClass

      @ScriptApi @NotNull public PojoConsumerRecordToTableWriterAdapter.Builder valueClass(@NotNull Class<?> valueClass)
      Set the class to use for deserialized values.
      Parameters:
      valueClass - the class for deserialized values
      Returns:
      this builder
    • allowUnmapped

      @ScriptApi @NotNull public PojoConsumerRecordToTableWriterAdapter.Builder allowUnmapped(boolean allowUnmapped)
      If set to true, unmapped columns are not an error.
      Parameters:
      allowUnmapped - should unmapped columns be ignored?
      Returns:
      this builder
    • caseInsensitiveSearch

      @ScriptApi @NotNull public PojoConsumerRecordToTableWriterAdapter.Builder caseInsensitiveSearch(boolean caseInsensitiveSearch)
      If set to true, a case insensitive search for column mappings is performed.
      Parameters:
      caseInsensitiveSearch - should a case-insensitive search for matching columns be performed?
      Returns:
      this builder
    • allowUnmapped

      @ScriptApi @NotNull public PojoConsumerRecordToTableWriterAdapter.Builder allowUnmapped(@NotNull String allowUnmapped)
      Specifies that the given column should not be mapped.
      Parameters:
      allowUnmapped - the column name that should remain unmapped
      Returns:
      this builder
    • addColumnToKeyField

      @ScriptApi @NotNull public PojoConsumerRecordToTableWriterAdapter.Builder addColumnToKeyField(@NotNull String column, @NotNull String field)
      Maps a column to a field in the key class
      Parameters:
      column - the column name in the output table
      field - a field name in the key class
      Returns:
      this builder
    • addColumnToKeyMethod

      @ScriptApi @NotNull public PojoConsumerRecordToTableWriterAdapter.Builder addColumnToKeyMethod(@NotNull String column, @NotNull String method)
      Maps a column to a method in the key class
      Parameters:
      column - the column name in the output table
      method - a method name in the key class
      Returns:
      this builder
    • addColumnToValueField

      @ScriptApi @NotNull public PojoConsumerRecordToTableWriterAdapter.Builder addColumnToValueField(@NotNull String column, @NotNull String field)
      Maps a column to a method in the value class
      Parameters:
      column - the column name in the output table
      field - a method name in the value class
      Returns:
      this builder
    • addColumnToValueMethod

      @ScriptApi @NotNull public PojoConsumerRecordToTableWriterAdapter.Builder addColumnToValueMethod(@NotNull String column, @NotNull String method)
      Maps a column to a method in the value class
      Parameters:
      column - the column name in the output table
      method - a method name in the value class
      Returns:
      this builder
    • addColumnToSetter

      @ScriptApi @NotNull public PojoConsumerRecordToTableWriterAdapter.Builder addColumnToSetter(@NotNull String column, @NotNull String setter)
      Maps a column to setter text in the compiled adapter class. The Kafka record will have the name "record", and can be referenced for example by: .addColumnToSetter("UserId", "((ksql.pageviews)record.value()).getUserid().toString()")
      Parameters:
      column - the column name
      setter - the setter text
      Returns:
      this builder
    • setPrintClassBody

      @ScriptApi @NotNull public PojoConsumerRecordToTableWriterAdapter.Builder setPrintClassBody(boolean printClassBody)
    • setFilter

      @ScriptApi @NotNull public PojoConsumerRecordToTableWriterAdapter.Builder setFilter(Predicate<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>> recordPredicate)
      If a filter is added, then all records will be passed through the predicate before being consumed. Only records that match the predicate will be ingested.
      Parameters:
      recordPredicate - returns true if the record should be ingested, otherwise false
      Returns:
      this builder