Search in sources :

Example 1 with TaskApplicationDescriptor

use of org.apache.samza.application.descriptors.TaskApplicationDescriptor 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)

Aggregations

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