From a549810899c67f99447a7e537a3b1e3cbba02973 Mon Sep 17 00:00:00 2001 From: Soby Chacko Date: Mon, 15 Jun 2020 18:49:35 -0400 Subject: [PATCH] Renaming Kafka Streams topology actuator endpoint Kafka Streams topology actuator endpoint had a conflict with the JMX exporter and was causing some IDE issues. Renming this endpoint to kafkastreamstopology. Renaming the underlying methods in this actuator endpoint implentation. Updating docs. Resolves https://github.com/spring-cloud/spring-cloud-stream-binder-kafka/issues/895 --- docs/src/main/asciidoc/kafka-streams.adoc | 8 ++++---- ...Endpoint.java => KafkaStreamsTopologyEndpoint.java} | 10 +++++----- ...KafkaStreamsTopologyEndpointAutoConfiguration.java} | 6 +++--- .../src/main/resources/META-INF/spring.factories | 2 +- .../KafkaStreamsBinderWordCountFunctionTests.java | 8 ++++---- 5 files changed, 17 insertions(+), 17 deletions(-) rename spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/endpoint/{TopologyEndpoint.java => KafkaStreamsTopologyEndpoint.java} (89%) rename spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/endpoint/{TopologyEndpointAutoConfiguration.java => KafkaStreamsTopologyEndpointAutoConfiguration.java} (87%) diff --git a/docs/src/main/asciidoc/kafka-streams.adoc b/docs/src/main/asciidoc/kafka-streams.adoc index 0913adbc..3c543f99 100644 --- a/docs/src/main/asciidoc/kafka-streams.adoc +++ b/docs/src/main/asciidoc/kafka-streams.adoc @@ -1453,13 +1453,13 @@ To modify this behavior simply add a single `CleanupConfig` `@Bean` (configured Kafka Streams binder provides the following actuator endpoints for retrieving the topology description using which you can visualize the topology using external tools. -`/actuator/topology` +`/actuator/kafkastreamstopology` -`/actuator/topology/` +`/actuator/kafkastreamstopology/` You need to include the actuator and web dependencies from Spring Boot to access these endpoints. -Further, you also need to add `topology` to `management.endpoints.web.exposure.include` property. -By default, the `topology` endpoint is disabled. +Further, you also need to add `kafkastreamstopology` to `management.endpoints.web.exposure.include` property. +By default, the `kafkastreamstopology` endpoint is disabled. === Configuration Options diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/endpoint/TopologyEndpoint.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/endpoint/KafkaStreamsTopologyEndpoint.java similarity index 89% rename from spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/endpoint/TopologyEndpoint.java rename to spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/endpoint/KafkaStreamsTopologyEndpoint.java index 12933045..3ee1dcb8 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/endpoint/TopologyEndpoint.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/endpoint/KafkaStreamsTopologyEndpoint.java @@ -31,8 +31,8 @@ import org.springframework.util.StringUtils; * @author Soby Chacko * @since 3.0.4 */ -@Endpoint(id = "topology") -public class TopologyEndpoint { +@Endpoint(id = "kafkastreamstopology") +public class KafkaStreamsTopologyEndpoint { /** * Topology not found message. @@ -41,12 +41,12 @@ public class TopologyEndpoint { private final KafkaStreamsRegistry kafkaStreamsRegistry; - public TopologyEndpoint(KafkaStreamsRegistry kafkaStreamsRegistry) { + public KafkaStreamsTopologyEndpoint(KafkaStreamsRegistry kafkaStreamsRegistry) { this.kafkaStreamsRegistry = kafkaStreamsRegistry; } @ReadOperation - public String topology() { + public String kafkaStreamsTopology() { final List streamsBuilderFactoryBeans = this.kafkaStreamsRegistry.streamsBuilderFactoryBeans(); final StringBuilder topologyDescription = new StringBuilder(); streamsBuilderFactoryBeans.stream() @@ -56,7 +56,7 @@ public class TopologyEndpoint { } @ReadOperation - public String topology(@Selector String applicationId) { + public String kafkaStreamsTopology(@Selector String applicationId) { if (!StringUtils.isEmpty(applicationId)) { final StreamsBuilderFactoryBean streamsBuilderFactoryBean = this.kafkaStreamsRegistry.streamsBuilderFactoryBean(applicationId); if (streamsBuilderFactoryBean != null) { diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/endpoint/TopologyEndpointAutoConfiguration.java b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/endpoint/KafkaStreamsTopologyEndpointAutoConfiguration.java similarity index 87% rename from spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/endpoint/TopologyEndpointAutoConfiguration.java rename to spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/endpoint/KafkaStreamsTopologyEndpointAutoConfiguration.java index 3ef6ffa2..a3c9f776 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/endpoint/TopologyEndpointAutoConfiguration.java +++ b/spring-cloud-stream-binder-kafka-streams/src/main/java/org/springframework/cloud/stream/binder/kafka/streams/endpoint/KafkaStreamsTopologyEndpointAutoConfiguration.java @@ -33,11 +33,11 @@ import org.springframework.context.annotation.Configuration; @ConditionalOnClass(name = { "org.springframework.boot.actuate.endpoint.annotation.Endpoint" }) @AutoConfigureAfter({EndpointAutoConfiguration.class, KafkaStreamsBinderSupportAutoConfiguration.class}) -public class TopologyEndpointAutoConfiguration { +public class KafkaStreamsTopologyEndpointAutoConfiguration { @Bean @ConditionalOnAvailableEndpoint - public TopologyEndpoint topologyEndpoint(KafkaStreamsRegistry kafkaStreamsRegistry) { - return new TopologyEndpoint(kafkaStreamsRegistry); + public KafkaStreamsTopologyEndpoint topologyEndpoint(KafkaStreamsRegistry kafkaStreamsRegistry) { + return new KafkaStreamsTopologyEndpoint(kafkaStreamsRegistry); } } diff --git a/spring-cloud-stream-binder-kafka-streams/src/main/resources/META-INF/spring.factories b/spring-cloud-stream-binder-kafka-streams/src/main/resources/META-INF/spring.factories index 92eb1612..ca6492f0 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/main/resources/META-INF/spring.factories +++ b/spring-cloud-stream-binder-kafka-streams/src/main/resources/META-INF/spring.factories @@ -1,4 +1,4 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ org.springframework.cloud.stream.binder.kafka.streams.KafkaStreamsBinderSupportAutoConfiguration,\ org.springframework.cloud.stream.binder.kafka.streams.function.KafkaStreamsFunctionAutoConfiguration,\ - org.springframework.cloud.stream.binder.kafka.streams.endpoint.TopologyEndpointAutoConfiguration + org.springframework.cloud.stream.binder.kafka.streams.endpoint.KafkaStreamsTopologyEndpointAutoConfiguration diff --git a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/function/KafkaStreamsBinderWordCountFunctionTests.java b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/function/KafkaStreamsBinderWordCountFunctionTests.java index e3cd109a..1c7f6831 100644 --- a/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/function/KafkaStreamsBinderWordCountFunctionTests.java +++ b/spring-cloud-stream-binder-kafka-streams/src/test/java/org/springframework/cloud/stream/binder/kafka/streams/function/KafkaStreamsBinderWordCountFunctionTests.java @@ -45,7 +45,7 @@ import org.springframework.boot.WebApplicationType; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.cloud.stream.binder.kafka.streams.InteractiveQueryService; import org.springframework.cloud.stream.binder.kafka.streams.KafkaStreamsRegistry; -import org.springframework.cloud.stream.binder.kafka.streams.endpoint.TopologyEndpoint; +import org.springframework.cloud.stream.binder.kafka.streams.endpoint.KafkaStreamsTopologyEndpoint; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.kafka.config.StreamsBuilderFactoryBeanCustomizer; @@ -112,9 +112,9 @@ public class KafkaStreamsBinderWordCountFunctionTests { Assert.isTrue(LATCH.await(5, TimeUnit.SECONDS), "Failed to call customizers"); //Testing topology endpoint final KafkaStreamsRegistry kafkaStreamsRegistry = context.getBean(KafkaStreamsRegistry.class); - final TopologyEndpoint topologyEndpoint = new TopologyEndpoint(kafkaStreamsRegistry); - final String topology1 = topologyEndpoint.topology(); - final String topology2 = topologyEndpoint.topology("testKstreamWordCountFunction"); + final KafkaStreamsTopologyEndpoint kafkaStreamsTopologyEndpoint = new KafkaStreamsTopologyEndpoint(kafkaStreamsRegistry); + final String topology1 = kafkaStreamsTopologyEndpoint.kafkaStreamsTopology(); + final String topology2 = kafkaStreamsTopologyEndpoint.kafkaStreamsTopology("testKstreamWordCountFunction"); assertThat(topology1).isNotEmpty(); assertThat(topology1).isEqualTo(topology2); }