K
- the type of the key in this tableV
- the type of the value in this tableD
- the type of the concrete table descriptorpublic abstract class LocalTableDescriptor<K,V,D extends LocalTableDescriptor<K,V,D>> extends BaseTableDescriptor<K,V,D>
Modifier and Type | Field and Description |
---|---|
protected java.lang.Integer |
changelogReplicationFactor |
protected java.lang.String |
changelogStream |
protected boolean |
enableChangelog |
protected KVSerde<K,V> |
serde |
protected java.util.List<java.lang.String> |
sideInputs |
protected SideInputsProcessor |
sideInputsProcessor |
static java.util.regex.Pattern |
SYSTEM_STREAM_NAME_PATTERN |
config, tableId
Constructor and Description |
---|
LocalTableDescriptor(java.lang.String tableId,
KVSerde<K,V> serde)
Constructs a table descriptor instance
|
Modifier and Type | Method and Description |
---|---|
protected void |
addStoreConfig(java.lang.String key,
java.lang.String value,
java.util.Map<java.lang.String,java.lang.String> tableConfig)
Helper method to add a store level config item to table configuration
|
KVSerde<K,V> |
getSerde()
Get the serde assigned to this
TableDescriptor |
java.util.List<java.lang.String> |
getSideInputs()
Get side input stream names
|
java.util.Map<java.lang.String,java.lang.String> |
toConfig(Config jobConfig)
Generate configuration for this table descriptor, the generated configuration
should be the complete configuration for this table that can be directly
included in the job configuration.
|
protected void |
validate()
Validate that this table descriptor is constructed properly; this method is used internally.
|
D |
withChangelogEnabled()
Enable changelog for this table, by default changelog is disabled.
|
D |
withChangelogReplicationFactor(int replicationFactor)
The property defines the number of replicas to use for the change log stream.
|
D |
withChangelogStream(java.lang.String changelogStream)
Samza stores are local to a container.
|
D |
withSideInputs(java.util.List<java.lang.String> sideInputs)
Add side inputs to the table.
|
D |
withSideInputsProcessor(SideInputsProcessor sideInputsProcessor)
Provide the
SideInputsProcessor for this table. |
addTableConfig, getProviderFactoryClassName, getTableId, withConfig
public static final java.util.regex.Pattern SYSTEM_STREAM_NAME_PATTERN
protected boolean enableChangelog
protected java.lang.String changelogStream
protected java.lang.Integer changelogReplicationFactor
protected java.util.List<java.lang.String> sideInputs
protected SideInputsProcessor sideInputsProcessor
public D withSideInputs(java.util.List<java.lang.String> sideInputs)
withSideInputsProcessor(SideInputsProcessor)
, which is
will be applied to the incoming messages and the results are written to the table.sideInputs
- list of side input streamspublic D withSideInputsProcessor(SideInputsProcessor sideInputsProcessor)
SideInputsProcessor
for this table. It is applied on the side inputs and the results are
written to the table.sideInputsProcessor
- a side input processorpublic D withChangelogEnabled()
stores.store-name.changelog
in Samza configuration guidepublic D withChangelogStream(java.lang.String changelogStream)
job.changelog.system
config. Any output stream can be used as
changelog, but you must ensure that only one job ever writes to a given changelog
stream (each instance of a job and each store needs its own changelog stream).
Refer to stores.store-name.changelog
in Samza configuration guide
changelogStream
- changelog stream namepublic D withChangelogReplicationFactor(int replicationFactor)
Default value is stores.default.changelog.replication.factor
.
Refer to stores.store-name.changelog.replication.factor
in Samza configuration guide
replicationFactor
- replication factorpublic java.util.Map<java.lang.String,java.lang.String> toConfig(Config jobConfig)
jobConfig
.
Note: Serdes are expected to be generated during configuration generation
of the job node, which is not handled here.toConfig
in interface TableDescriptor<K,V,D extends LocalTableDescriptor<K,V,D>>
toConfig
in class BaseTableDescriptor<K,V,D extends LocalTableDescriptor<K,V,D>>
jobConfig
- job configurationpublic java.util.List<java.lang.String> getSideInputs()
public KVSerde<K,V> getSerde()
TableDescriptor
KVSerde
used by this tableprotected void validate()
BaseTableDescriptor
validate
in class BaseTableDescriptor<K,V,D extends LocalTableDescriptor<K,V,D>>
protected void addStoreConfig(java.lang.String key, java.lang.String value, java.util.Map<java.lang.String,java.lang.String> tableConfig)
key
- key of the config itemvalue
- value of the config itemtableConfig
- table configuration