【发布时间】:2020-10-09 18:15:00
【问题描述】:
假设我们在 2 台不同的机器(实例)上启动了 2 个 Streaming-Tasks,具有以下属性:-
public final static String applicationID = "StreamsPOC";
public final static String bootstrapServers = "10.21.22.56:9093";
public final static String topicname = "TestTransaction";
public final static String shipmentTopicName = "TestShipment";
public final static String RECORD_COUNT_STORE_NAME = "ProcessorONEStore";
使用上述这些属性,流任务的定义如下所示:-
Map<String, String> changelogConfig = new HashMap();
changelogConfig.put("min.insyc.replicas", "1");
// Below line not working.
changelogConfig.put("topic", "myChangedTopicLog");
StoreBuilder kvStoreBuilder = Stores.keyValueStoreBuilder(
Stores.persistentKeyValueStore(AppConfigs.RECORD_COUNT_STORE_NAME),
AppSerdes.String(), AppSerdes.Integer()
).withLoggingEnabled(changelogConfig);
kStreamBuilder.addStateStore(kvStoreBuilder);
KStream<String, String> sourceKafkaStream = kStreamBuilder.stream
(AppConfigs.topicname, Consumed.with(AppSerdes.String(), AppSerdes.String()));
现在,正如我所观察到的,kafka 在后台创建了主题(用于备份内部状态存储),名称如下:- StreamsPOC-ProcessorONEStore-changelog
第一个问题是:- 两个不同的流式传输任务是否都维护内部状态存储并将其备份到同一主题?
第二个问题是 ;- 假设 Task-1 在分区 1 上接机并将
第三个问题是:- 我如何指定自定义名称来更改日志主题?
非常感谢您的回复!
【问题讨论】:
标签: apache-kafka apache-kafka-streams