I am new to Kafka and have tried to create a small Kafka KTable implementation. I have successfully added a KTable and was able to query. I have used local state store and it worked as expected. Below is my Local State Store Config
@Bean(name = KafkaStreamsDefaultConfiguration.DEFAULT_STREAMS_CONFIG_BEAN_NAME)
public KafkaStreamsConfiguration kafkaConfiguration(final KafkaProperties kafkaProperties) {
Map<String, Object> config = new HashMap<>();
config.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaProperties.getBootstrapServers());
config.put(StreamsConfig.APPLICATION_ID_CONFIG, kafkaProperties.getClientId());
config.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.String().getClass());
config.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, MessageSerdes.class.getName());
config.put(StreamsConfig.STATE_DIR_CONFIG, directory);
//TODO : verify error strategy
config.put(StreamsConfig.DEFAULT_DESERIALIZATION_EXCEPTION_HANDLER_CLASS_CONFIG, LogAndContinueExceptionHandler.class);
return new KafkaStreamsConfiguration(config);
}
Now I want to use Global State using RPC . I am confused with few questions. To add a Global State Store I need to add RPC endpoint
config.put(StreamsConfig.APPLICATION_SERVER_CONFIG, "127.0.0.1:8080");
The documentation says
"The only requirements are that the RPC layer is embedded within the Kafka Streams application "
- Does this mean we need to create a client endpoint within Kafka application , if so , if its a Spring Boot application with web dependency is it like "localhost:8080"
- How will other instances of this application will connect only via APPLICATION_SERVER_CONFIG (application.server) and perform interactive queries or keep the state at sync. I mean How to provide additional configuration for other instances of same application to create a sync in Global state .
- If Global state is created Do we need to keep a backup at Mongodb or other place for whatsoever reason. (Fault tolerance) Considering DB will never be as fast as writing to disk , Do we even care for it or should rely on distributed architecture
It would be great if some Kafka Global State Store implementation with example is given.