Interactive query - polishing
Renaming InteractiveQueryServices to InteractiveQueryService
This commit is contained in:
@@ -39,7 +39,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Renwei Han
|
||||
* @since 2.1.0
|
||||
*/
|
||||
public class InteractiveQueryServices {
|
||||
public class InteractiveQueryService {
|
||||
|
||||
private final KafkaStreamsRegistry kafkaStreamsRegistry;
|
||||
private final KafkaStreamsBinderConfigurationProperties binderConfigurationProperties;
|
||||
@@ -49,8 +49,8 @@ public class InteractiveQueryServices {
|
||||
* @param kafkaStreamsRegistry holding {@link KafkaStreamsRegistry}
|
||||
* @param binderConfigurationProperties Kafka Streams binder configuration properties
|
||||
*/
|
||||
public InteractiveQueryServices(KafkaStreamsRegistry kafkaStreamsRegistry,
|
||||
KafkaStreamsBinderConfigurationProperties binderConfigurationProperties) {
|
||||
public InteractiveQueryService(KafkaStreamsRegistry kafkaStreamsRegistry,
|
||||
KafkaStreamsBinderConfigurationProperties binderConfigurationProperties) {
|
||||
this.kafkaStreamsRegistry = kafkaStreamsRegistry;
|
||||
this.binderConfigurationProperties = binderConfigurationProperties;
|
||||
}
|
||||
@@ -149,9 +149,9 @@ public class KafkaStreamsBinderSupportAutoConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public InteractiveQueryServices interactiveQueryServices(KafkaStreamsRegistry kafkaStreamsRegistry,
|
||||
public InteractiveQueryService interactiveQueryServices(KafkaStreamsRegistry kafkaStreamsRegistry,
|
||||
KafkaStreamsBinderConfigurationProperties binderConfigurationProperties) {
|
||||
return new InteractiveQueryServices(kafkaStreamsRegistry, binderConfigurationProperties);
|
||||
return new InteractiveQueryService(kafkaStreamsRegistry, binderConfigurationProperties);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.apache.kafka.streams.state.QueryableStoreType;
|
||||
* @author Soby Chacko
|
||||
* @author Renwei Han
|
||||
* @since 2.0.0
|
||||
* @deprecated in favor of {@link InteractiveQueryServices}
|
||||
* @deprecated in favor of {@link InteractiveQueryService}
|
||||
*/
|
||||
public class QueryableStoreRegistry {
|
||||
|
||||
@@ -44,7 +44,7 @@ public class QueryableStoreRegistry {
|
||||
* @param storeType type of the queryable store
|
||||
* @param <T> generic queryable store
|
||||
* @return queryable store.
|
||||
* @deprecated in favor of {@link InteractiveQueryServices#getQueryableStore(String, QueryableStoreType)}
|
||||
* @deprecated in favor of {@link InteractiveQueryService#getQueryableStore(String, QueryableStoreType)}
|
||||
*/
|
||||
public <T> T getQueryableStoreType(String storeName, QueryableStoreType<T> storeType) {
|
||||
|
||||
|
||||
@@ -112,15 +112,15 @@ public class KafkaStreamsInteractiveQueryIntegrationTests {
|
||||
ProductCountApplication.Foo foo = context.getBean(ProductCountApplication.Foo.class);
|
||||
assertThat(foo.getProductStock(123).equals(1L));
|
||||
|
||||
//perform assertions on HostInfo related methods in InteractiveQueryServices
|
||||
InteractiveQueryServices interactiveQueryServices = context.getBean(InteractiveQueryServices.class);
|
||||
HostInfo currentHostInfo = interactiveQueryServices.getCurrentHostInfo();
|
||||
//perform assertions on HostInfo related methods in InteractiveQueryService
|
||||
InteractiveQueryService interactiveQueryService = context.getBean(InteractiveQueryService.class);
|
||||
HostInfo currentHostInfo = interactiveQueryService.getCurrentHostInfo();
|
||||
assertThat(currentHostInfo.host() + ":" + currentHostInfo.port()).isEqualTo(embeddedKafka.getBrokersAsString());
|
||||
|
||||
HostInfo hostInfo = interactiveQueryServices.getHostInfo("prod-id-count-store", 123, new IntegerSerializer());
|
||||
HostInfo hostInfo = interactiveQueryService.getHostInfo("prod-id-count-store", 123, new IntegerSerializer());
|
||||
assertThat(hostInfo.host() + ":" + hostInfo.port()).isEqualTo(embeddedKafka.getBrokersAsString());
|
||||
|
||||
HostInfo hostInfoFoo = interactiveQueryServices.getHostInfo("prod-id-count-store-foo", 123, new IntegerSerializer());
|
||||
HostInfo hostInfoFoo = interactiveQueryService.getHostInfo("prod-id-count-store-foo", 123, new IntegerSerializer());
|
||||
assertThat(hostInfoFoo).isNull();
|
||||
}
|
||||
|
||||
@@ -143,20 +143,20 @@ public class KafkaStreamsInteractiveQueryIntegrationTests {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Foo foo(InteractiveQueryServices interactiveQueryServices) {
|
||||
return new Foo(interactiveQueryServices);
|
||||
public Foo foo(InteractiveQueryService interactiveQueryService) {
|
||||
return new Foo(interactiveQueryService);
|
||||
}
|
||||
|
||||
static class Foo {
|
||||
InteractiveQueryServices interactiveQueryServices;
|
||||
InteractiveQueryService interactiveQueryService;
|
||||
|
||||
Foo(InteractiveQueryServices interactiveQueryServices) {
|
||||
this.interactiveQueryServices = interactiveQueryServices;
|
||||
Foo(InteractiveQueryService interactiveQueryService) {
|
||||
this.interactiveQueryService = interactiveQueryService;
|
||||
}
|
||||
|
||||
public Long getProductStock(Integer id) {
|
||||
ReadOnlyKeyValueStore<Object, Object> keyValueStore =
|
||||
interactiveQueryServices.getQueryableStore("prod-id-count-store", QueryableStoreTypes.keyValueStore());
|
||||
interactiveQueryService.getQueryableStore("prod-id-count-store", QueryableStoreTypes.keyValueStore());
|
||||
|
||||
return (Long) keyValueStore.get(id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user