application.server identifies the host and port where a Kafka Streams instance exposes query access for Interactive Queries. Configure a unique host:port for every instance sharing an application ID. section 13.2
Use application.server as part of the query-routing setup:
- Configure the instance’s reachable host and port. section 13.2
- Build a HostInfo value from the configuration for comparison with query metadata. section 13.2.1
- Route the query locally when metadata identifies the current host; otherwise call the responsible instance through its REST endpoint. section 13.2.1
Routing a loan-category query
A Spring Boot controller reads application.server, converts its host and port into HostInfo, and compares it with the HostInfo returned by KeyQueryMetadata. Matching hosts query the local state store; different hosts receive the request remotely. section 13.2.1
Listing 13.9 Building a HostInfo object from the application server configuration
@PostConstruct
public void init() {
String[] parts = applicationServer.split(":");
thisHostInfo = new HostInfo(parts[0],
Integer.parseInt(parts[1])); #1
}
See the Java initialization that splits application.server into host and port and constructs the current instance’s HostInfo. section 13.2.1
