Search in sources :

Example 1 with RocksDbTableDescriptor

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);
    });
}
Also used : StringSerde(org.apache.samza.serializers.StringSerde) TaskApplicationDescriptor(org.apache.samza.application.descriptors.TaskApplicationDescriptor) RocksDbTableDescriptor(org.apache.samza.storage.kv.descriptors.RocksDbTableDescriptor) KV(org.apache.samza.operators.KV) KafkaSystemDescriptor(org.apache.samza.system.kafka.descriptors.KafkaSystemDescriptor)

Example 2 with RocksDbTableDescriptor

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());
}
Also used : StringSerde(org.apache.samza.serializers.StringSerde) KVSerde(org.apache.samza.serializers.KVSerde) RocksDbTableDescriptor(org.apache.samza.storage.kv.descriptors.RocksDbTableDescriptor) NoOpSerde(org.apache.samza.serializers.NoOpSerde) KafkaSystemDescriptor(org.apache.samza.system.kafka.descriptors.KafkaSystemDescriptor) RocksDbTableDescriptor(org.apache.samza.storage.kv.descriptors.RocksDbTableDescriptor) TableDescriptor(org.apache.samza.table.descriptors.TableDescriptor)

Aggregations

StringSerde (org.apache.samza.serializers.StringSerde)2 RocksDbTableDescriptor (org.apache.samza.storage.kv.descriptors.RocksDbTableDescriptor)2 KafkaSystemDescriptor (org.apache.samza.system.kafka.descriptors.KafkaSystemDescriptor)2 TaskApplicationDescriptor (org.apache.samza.application.descriptors.TaskApplicationDescriptor)1 KV (org.apache.samza.operators.KV)1 KVSerde (org.apache.samza.serializers.KVSerde)1 NoOpSerde (org.apache.samza.serializers.NoOpSerde)1 TableDescriptor (org.apache.samza.table.descriptors.TableDescriptor)1