use of org.apache.samza.storage.kv.descriptors.RocksDbTableDescriptor in project samza by apache.
the class MyStatefulApplication method describe.
@Override
public void describe(TaskApplicationDescriptor appDescriptor) {
KafkaSystemDescriptor ksd = new KafkaSystemDescriptor(inputSystem);
KVSerde<String, String> serde = KVSerde.of(new StringSerde(), new StringSerde());
KafkaInputDescriptor<KV<String, String>> isd = ksd.getInputDescriptor(inputTopic, serde);
TaskApplicationDescriptor desc = appDescriptor.withInputStream(isd).withTaskFactory((StreamTaskFactory) () -> new MyTask(storeToChangelog.keySet()));
storeToChangelog.forEach((storeName, changelogTopic) -> {
RocksDbTableDescriptor<String, String> td = new RocksDbTableDescriptor<>(storeName, serde).withChangelogStream(changelogTopic).withChangelogReplicationFactor(1);
desc.withTable(td);
});
}
use of org.apache.samza.storage.kv.descriptors.RocksDbTableDescriptor in project samza by apache.
the class TaskApplicationExample method describe.
@Override
public void describe(TaskApplicationDescriptor appDescriptor) {
// add input and output streams
KafkaSystemDescriptor ksd = new KafkaSystemDescriptor("tracking");
KafkaInputDescriptor<String> isd = ksd.getInputDescriptor("myinput", new StringSerde());
KafkaOutputDescriptor<String> osd = ksd.getOutputDescriptor("myout", new StringSerde());
TableDescriptor td = new RocksDbTableDescriptor("mytable", new KVSerde(new NoOpSerde(), new NoOpSerde()));
appDescriptor.withInputStream(isd).withOutputStream(osd).withTable(td).withTaskFactory((StreamTaskFactory) () -> new MyStreamTask());
}
Aggregations