Package io.deephaven.kafka.ingest
Class PojoConsumerRecordToTableWriterAdapter.Builder
java.lang.Object
io.deephaven.kafka.ingest.PojoConsumerRecordToTableWriterAdapter.Builder
- Enclosing class:
- PojoConsumerRecordToTableWriterAdapter<K,
V>
A builder for the PojoConsumerRecordToTableWriterAdapter.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddColumnToKeyField
(String column, String field) Maps a column to a field in the key classaddColumnToKeyMethod
(String column, String method) Maps a column to a method in the key classaddColumnToSetter
(String column, String setter) Maps a column to setter text in the compiled adapter class.addColumnToValueField
(String column, String field) Maps a column to a method in the value classaddColumnToValueMethod
(String column, String method) Maps a column to a method in the value classallowUnmapped
(boolean allowUnmapped) If set to true, unmapped columns are not an error.allowUnmapped
(String allowUnmapped) Specifies that the given column should not be mapped.caseInsensitiveSearch
(boolean caseInsensitiveSearch) If set to true, a case insensitive search for column mappings is performed.kafkaPartitionColumnName
(String kafkaPartitionColumnName) Set the name of the column which stores the Kafka partition identifier of the record.Set the class to use for deserialized keys.offsetColumnName
(String offsetColumnName) Set the name of the column which stores the Kafka offset of the record.recvTimeColumnName
(String recvTimeColumnName) Set the name of the column which stores the time that the record was received by the ingester.If a filter is added, then all records will be passed through the predicate before being consumed.setPrintClassBody
(boolean printClassBody) timestampColumnName
(String timestampColumnName) Set the name of the column which stores the Kafka timestamp of the record.valueClass
(Class<?> valueClass) Set the class to use for deserialized values.
-
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 tablefield
- 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 tablemethod
- 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 tablefield
- 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 tablemethod
- 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 namesetter
- 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
-