Package io.deephaven.kafka.ingest
Class JsonConsumerRecordToTableWriterAdapter.Builder
java.lang.Object
io.deephaven.kafka.ingest.JsonConsumerRecordToTableWriterAdapter.Builder
- Enclosing class:
- JsonConsumerRecordToTableWriterAdapter
public static class JsonConsumerRecordToTableWriterAdapter.Builder extends Object
A builder to map key and value fields to table columns.
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
Modifier and Type Method Description JsonConsumerRecordToTableWriterAdapter.Builder
addColumnToValueField(String column, String field)
Map a column to a field in the value record.JsonConsumerRecordToTableWriterAdapter.Builder
addColumnToValueFunction(String column, Function<JsonRecord,?> function)
Map a column to a function of the value record.JsonConsumerRecordToTableWriterAdapter.Builder
allowMissingKeys(boolean allowMissingKeys)
If allowMissingKeys is set, then a request for a value using a key that is not found in the record will receive a null value.JsonConsumerRecordToTableWriterAdapter.Builder
allowNullValues(boolean allowNullValues)
If allowNullValues is set, then records with a null value will have their columns null filled; otherwise an exception is thrown on receipt of a null value.JsonConsumerRecordToTableWriterAdapter.Builder
allowUnmapped(String allowUnmapped)
Allow the column with the given name to be unmapped in the output.JsonConsumerRecordToTableWriterAdapter.Builder
autoValueMapping(boolean autoValueMapping)
If autoValueMapping is set, then all unused columns are mapped to a field of the same name in the generic record.JsonConsumerRecordToTableWriterAdapter.Builder
caseInsensitiveSearch(boolean caseInsensitiveSearch)
IfautoValueMapping(boolean)
is set to true, then all unused columns are mapped to a field of the same name in the generic record without regard to case.JsonConsumerRecordToTableWriterAdapter.Builder
kafkaPartitionColumnName(String kafkaPartitionColumnName)
Set the name of the column which stores the Kafka partition identifier of the record.JsonConsumerRecordToTableWriterAdapter.Builder
offsetColumnName(String offsetColumnName)
Set the name of the column which stores the Kafka offset of the record.JsonConsumerRecordToTableWriterAdapter.Builder
timestampColumnName(String timestampColumnName)
Set the name of the column which stores the Kafka timestamp of the record.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
kafkaPartitionColumnName
@NotNull public JsonConsumerRecordToTableWriterAdapter.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
-
offsetColumnName
public JsonConsumerRecordToTableWriterAdapter.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
-
timestampColumnName
@NotNull public JsonConsumerRecordToTableWriterAdapter.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
-
allowUnmapped
@NotNull public JsonConsumerRecordToTableWriterAdapter.Builder allowUnmapped(@NotNull String allowUnmapped)Allow the column with the given name to be unmapped in the output. Unmapped columns will have no setter, and will thus be null filled in the output.- Parameters:
allowUnmapped
- the column name to allow to be unmapped- Returns:
- this builder
-
addColumnToValueField
@NotNull public JsonConsumerRecordToTableWriterAdapter.Builder addColumnToValueField(@NotNull String column, @NotNull String field)Map a column to a field in the value record.- Parameters:
column
- the name of the output columnfield
- the name of the field in the value record- Returns:
- this builder
-
addColumnToValueFunction
@NotNull public JsonConsumerRecordToTableWriterAdapter.Builder addColumnToValueFunction(@NotNull String column, @NotNull Function<JsonRecord,?> function)Map a column to a function of the value record.- Parameters:
column
- the name of the output columnfunction
- the function to apply to the value record- Returns:
- this builder
-
allowMissingKeys
@NotNull public JsonConsumerRecordToTableWriterAdapter.Builder allowMissingKeys(boolean allowMissingKeys)If allowMissingKeys is set, then a request for a value using a key that is not found in the record will receive a null value. Otherwise, an exception is thrown when a key is not found in the record.- Parameters:
allowMissingKeys
- to allow quietly continuing if requested value's key is not in the current record.- Returns:
- this builder
-
allowNullValues
@NotNull public JsonConsumerRecordToTableWriterAdapter.Builder allowNullValues(boolean allowNullValues)If allowNullValues is set, then records with a null value will have their columns null filled; otherwise an exception is thrown on receipt of a null value. If no value fields are set, then no columns are taken from the value; so this flag has no effect.- Parameters:
allowNullValues
- if null values are allowed- Returns:
- this builder
-
autoValueMapping
@NotNull public JsonConsumerRecordToTableWriterAdapter.Builder autoValueMapping(boolean autoValueMapping)If autoValueMapping is set, then all unused columns are mapped to a field of the same name in the generic record.- Parameters:
autoValueMapping
- if unused columns should be automatically mapped to a field of the same name- Returns:
- this builder
-
caseInsensitiveSearch
@NotNull public JsonConsumerRecordToTableWriterAdapter.Builder caseInsensitiveSearch(boolean caseInsensitiveSearch)IfautoValueMapping(boolean)
is set to true, then all unused columns are mapped to a field of the same name in the generic record without regard to case. For example, a json record field ofwidgetId
would be matched to a table column namedWidgetID
.- Parameters:
caseInsensitiveSearch
- should a case-insensitive search for matching columns be performed?- Returns:
- this builder
-