@Slf4j
public class QueryStreamProcessor
{
+ public static final String STORE_NAME = "rankings-by-username";
+
public final KafkaStreams streams;
public final HostInfo hostInfo;
- public final String storeName = "rankingsByUsername";
public final StoreQueryParameters<ReadOnlyKeyValueStore<String, String>> storeParameters;
public final ObjectMapper mapper;
throw new RuntimeException(e);
}
})
- .toTable(Materialized.as(storeName));
+ .toTable(Materialized.as(STORE_NAME));
streams = new KafkaStreams(builder.build(), props);
hostInfo = applicationServer;
- storeParameters = StoreQueryParameters.fromNameAndType(storeName, QueryableStoreTypes.keyValueStore());;
+ storeParameters = StoreQueryParameters.fromNameAndType(STORE_NAME, QueryableStoreTypes.keyValueStore());;
this.mapper = mapper;
}
public Optional<URI> getRedirect(String username)
{
- KeyQueryMetadata metadata = streams.queryMetadataForKey(storeName, username, Serdes.String().serializer());
+ KeyQueryMetadata metadata = streams.queryMetadataForKey(STORE_NAME, username, Serdes.String().serializer());
HostInfo activeHost = metadata.activeHost();
log.debug("Local store for {}: {}, {}:{}", username, metadata.partition(), activeHost.host(), activeHost.port());