diff --git a/.creek/bootstrap.sh b/.creek/bootstrap.sh deleted file mode 100755 index 27e4dc8..0000000 --- a/.creek/bootstrap.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/zsh -# -# Copyright 2022-2023 Creek Contributors (https://github.com/creek-service) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# Script for updating repositories created from the template. -# Usage: -# bootstrap.sh repoUserAndName repoUser - -if [[ $(echo "ab-cd" | sed 's/-\([a-z]\)/\U\1/g') != "abCd" ]]; then - echo "ERROR: incompatible version of sed detected." >&2 - exit 1; -fi - -repoUserAndName="$1" -repoUser="$2" -repoName="${repoUserAndName/${repoUser}\//}" -aggregateClass=$(echo "${(L)${repoName}}" | sed 's/\([-_]\)\([a-z]\)/\U\2/g' | sed 's/^\([a-z]\)/\U\1/')AggregateDescriptor -modNamePrefix=${(L)${repoName//([_-])/.}} -groupName="io.github.${(L)${repoUser//([_-])/.}}" -rootPackage="$groupName.$modNamePrefix" - -# sedCode(sedCmd) -function sedCode() { - find . -type f -not \( -path "*/.git/*" -o -path "*/build/*" -o -path "*/.gradle/*" \) -print0 | xargs -0 sed -i "$1" -} - -# replaceInCode(text-to-replace, replacement) -function replaceInCode() { - sedCode "s:$1:$2:g" -} - -# renamePackage(old-pkg-name, new-pkg-name) -function renamePackage() { - # Update code: - replaceInCode "$(echo "$1" | sed 's/\./\\./g')\." "$2." - - # Move code: - oldBasePattern=$(echo "$1" | sed 's/\./\\\//g') - oldBaseDir=$(echo "$1" | sed 's/\./\//g') - newBaseDir=$(echo "$2" | sed 's/\./\//g') - - find . -type f -path "*$oldBaseDir*" -not \( -path "*/.git/*" -o -path "*/build/*" -o -path "*/.gradle/*" \) -exec bash -c ' - newPath=${3/$1/$0} - mkdir -p "$(dirname $newPath)" - mv "$3" "$newPath" - ' "$newBaseDir" "$oldBasePattern" "$oldBaseDir" {} \; -} - -echo Prepare -rm -rf docs -find . -type d -empty -delete - -if [ "$repoUser" != "creek-service" ]; then - echo "Updating repo user to $repoUser" - replaceInCode "maven.pkg.github.com/creek-service/" "maven.pkg.github.com/$repoUser/" - replaceInCode "ghcr.io/creek-service/" "ghcr.io/${repoUser:l}/" - replaceInCode "github.com/creek-service/" "github.com/$repoUser/" -fi - -echo "Updating repo name to: $repoName" -replaceInCode "creek-service/basic-kafka-streams-demo" "$repoUserAndName" -replaceInCode "basic-kafka-streams-demo" "${(L)${repoName}}" - -echo "Updating aggregate descriptor to: $aggregateClass" -replaceInCode "BasicKafkaStreamsDemoAggregateDescriptor" "$aggregateClass" -mv "api/src/main/java/io/github/creek/service/basic/kafka/streams/demo/api/BasicKafkaStreamsDemoAggregateDescriptor.java" "api/src/main/java/io/github/creek/service/basic/kafka/streams/demo/api/$aggregateClass.java" - -echo "Updating root packages to: $rootPackage" -renamePackage "io.github.creek.service.basic.kafka.streams.demo" "$rootPackage" - -echo "Updating group name to: $groupName" -replaceInCode "group = \"io.github.creek.service\"" "group = \"$groupName\"" - -echo "Updating module names to have prefix: $modNamePrefix" -replaceInCode "basic.kafka.streams.demo" "$modNamePrefix" - -echo Update service module template -echo "$rootPackage" > ".creek/service_template/root.package" - -echo Revert workflow changes -# Changing workflows requires elevated privileges, only available via a PAT: -# So revert changes: -git checkout -- ".github/workflows/*" - -echo Tidying up -rm ./.creek/bootstrap.sh -rm .github/CODEOWNERS -find . -type d -empty -delete -./gradlew format \ No newline at end of file diff --git a/.creek/service_template/example-service/Dockerfile b/.creek/service_template/example-service/Dockerfile index 52b22b0..ad88ab0 100644 --- a/.creek/service_template/example-service/Dockerfile +++ b/.creek/service_template/example-service/Dockerfile @@ -3,7 +3,7 @@ ARG APP_NAME ARG APP_VERSION ENV VERSION=$APP_VERSION -LABEL org.opencontainers.image.source=https://github.com/creek-service/basic-kafka-streams-demo/tree/main/example-service +LABEL org.opencontainers.image.source=https://github.com/creek-service/connected-services-demo/tree/main/example-service RUN yum update -y RUN yum install -y tar lsof diff --git a/.creek/service_template/example-service/build.gradle.kts b/.creek/service_template/example-service/build.gradle.kts index e9b281c..d83e71b 100644 --- a/.creek/service_template/example-service/build.gradle.kts +++ b/.creek/service_template/example-service/build.gradle.kts @@ -40,8 +40,8 @@ dependencies { modularity.patchModule("kafka.streams", "kafka-streams-test-utils-$kafkaVersion.jar") application { - mainModule.set("basic.kafka.streams.demo.example.service") - mainClass.set("io.github.creek.service.basic.kafka.streams.demo.example.service.ServiceMain") + mainModule.set("connected.services.demo.example.service") + mainClass.set("io.github.creek.service.connected.services.demo.example.service.ServiceMain") } val buildAppImage = tasks.register("buildAppImage") { diff --git a/.creek/service_template/example-service/include/bin/run.sh b/.creek/service_template/example-service/include/bin/run.sh index 7380ca0..8ae9761 100755 --- a/.creek/service_template/example-service/include/bin/run.sh +++ b/.creek/service_template/example-service/include/bin/run.sh @@ -20,4 +20,4 @@ exec java \ -Xms64m -Xmx256m \ -Dlog4j.configurationFile=/log/log4j2.xml \ --module-path "/opt/creek/service/lib" \ - --module basic.kafka.streams.demo.example.service/io.github.creek.service.basic.kafka.streams.demo.example.service.ServiceMain + --module connected.services.demo.example.service/io.github.creek.service.connected.services.demo.example.service.ServiceMain diff --git a/.creek/service_template/example-service/src/main/java/io/github/creek/service/basic/kafka/streams/demo/example/service/ServiceMain.java b/.creek/service_template/example-service/src/main/java/io/github/creek/service/connected/services/demo/example/service/ServiceMain.java similarity index 86% rename from .creek/service_template/example-service/src/main/java/io/github/creek/service/basic/kafka/streams/demo/example/service/ServiceMain.java rename to .creek/service_template/example-service/src/main/java/io/github/creek/service/connected/services/demo/example/service/ServiceMain.java index 4a70b23..c8f4fb5 100644 --- a/.creek/service_template/example-service/src/main/java/io/github/creek/service/basic/kafka/streams/demo/example/service/ServiceMain.java +++ b/.creek/service_template/example-service/src/main/java/io/github/creek/service/connected/services/demo/example/service/ServiceMain.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.github.creek.service.basic.kafka.streams.demo.example.service; +package io.github.creek.service.connected.services.demo.example.service; -import io.github.creek.service.basic.kafka.streams.demo.example.service.kafka.streams.TopologyBuilder; -import io.github.creek.service.basic.kafka.streams.demo.services.ExampleServiceDescriptor; +import io.github.creek.service.connected.services.demo.example.service.kafka.streams.TopologyBuilder; +import io.github.creek.service.connected.services.demo.services.ExampleServiceDescriptor; import org.apache.kafka.streams.Topology; import org.creekservice.api.kafka.streams.extension.KafkaStreamsExtension; import org.creekservice.api.kafka.streams.extension.KafkaStreamsExtensionOptions; diff --git a/.creek/service_template/example-service/src/main/java/io/github/creek/service/basic/kafka/streams/demo/example/service/kafka/streams/TopologyBuilder.java b/.creek/service_template/example-service/src/main/java/io/github/creek/service/connected/services/demo/example/service/kafka/streams/TopologyBuilder.java similarity index 90% rename from .creek/service_template/example-service/src/main/java/io/github/creek/service/basic/kafka/streams/demo/example/service/kafka/streams/TopologyBuilder.java rename to .creek/service_template/example-service/src/main/java/io/github/creek/service/connected/services/demo/example/service/kafka/streams/TopologyBuilder.java index 626089e..b0bbfc1 100644 --- a/.creek/service_template/example-service/src/main/java/io/github/creek/service/basic/kafka/streams/demo/example/service/kafka/streams/TopologyBuilder.java +++ b/.creek/service_template/example-service/src/main/java/io/github/creek/service/connected/services/demo/example/service/kafka/streams/TopologyBuilder.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.github.creek.service.basic.kafka.streams.demo.example.service.kafka.streams; +package io.github.creek.service.connected.services.demo.example.service.kafka.streams; import static java.util.Objects.requireNonNull; import static org.creekservice.api.kafka.metadata.KafkaTopicDescriptor.DEFAULT_CLUSTER_NAME; -import io.github.creek.service.basic.kafka.streams.demo.services.ExampleServiceDescriptor; +import io.github.creek.service.connected.services.demo.services.ExampleServiceDescriptor; import org.apache.kafka.streams.KeyValue; import org.apache.kafka.streams.StreamsBuilder; import org.apache.kafka.streams.Topology; diff --git a/.creek/service_template/example-service/src/main/java/module-info.java b/.creek/service_template/example-service/src/main/java/module-info.java index 346f6d9..779e1e5 100644 --- a/.creek/service_template/example-service/src/main/java/module-info.java +++ b/.creek/service_template/example-service/src/main/java/module-info.java @@ -1,5 +1,5 @@ -module basic.kafka.streams.demo.example.service { - requires basic.kafka.streams.demo.services; +module connected.services.demo.example.service { + requires connected.services.demo.services; requires creek.service.context; requires creek.kafka.streams.extension; requires org.apache.logging.log4j; diff --git a/.creek/service_template/example-service/src/test/java/io/github/creek/service/basic/kafka/streams/demo/example/streams/TopologyBuilderTest.java b/.creek/service_template/example-service/src/test/java/io/github/creek/service/connected/services/demo/example/streams/TopologyBuilderTest.java similarity index 93% rename from .creek/service_template/example-service/src/test/java/io/github/creek/service/basic/kafka/streams/demo/example/streams/TopologyBuilderTest.java rename to .creek/service_template/example-service/src/test/java/io/github/creek/service/connected/services/demo/example/streams/TopologyBuilderTest.java index 29b5cd3..9153ec8 100644 --- a/.creek/service_template/example-service/src/test/java/io/github/creek/service/basic/kafka/streams/demo/example/streams/TopologyBuilderTest.java +++ b/.creek/service_template/example-service/src/test/java/io/github/creek/service/connected/services/demo/example/streams/TopologyBuilderTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.github.creek.service.basic.kafka.streams.demo.example.streams; +package io.github.creek.service.connected.services.demo.example.streams; import static org.apache.kafka.streams.KeyValue.pair; import static org.creekservice.api.kafka.metadata.KafkaTopicDescriptor.DEFAULT_CLUSTER_NAME; @@ -24,8 +24,8 @@ import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.is; -import io.github.creek.service.basic.kafka.streams.demo.example.service.kafka.streams.TopologyBuilder; -import io.github.creek.service.basic.kafka.streams.demo.services.ExampleServiceDescriptor; +import io.github.creek.service.connected.services.demo.example.service.kafka.streams.TopologyBuilder; +import io.github.creek.service.connected.services.demo.services.ExampleServiceDescriptor; import org.apache.kafka.streams.TestInputTopic; import org.apache.kafka.streams.TestOutputTopic; import org.apache.kafka.streams.Topology; diff --git a/.creek/service_template/example-service/src/test/java/module-info.test b/.creek/service_template/example-service/src/test/java/module-info.test index 8f5ad9c..c7c13d4 100644 --- a/.creek/service_template/example-service/src/test/java/module-info.test +++ b/.creek/service_template/example-service/src/test/java/module-info.test @@ -2,7 +2,7 @@ org.junitpioneer,org.hamcrest,guava.testlib,creek.test.util,creek.test.hamcrest,creek.kafka.streams.test --add-reads - basic.kafka.streams.demo.example.service=org.junitpioneer,org.hamcrest,guava.testlib,creek.test.util,creek.test.hamcrest,creek.kafka.streams.test + connected.services.demo.example.service=org.junitpioneer,org.hamcrest,guava.testlib,creek.test.util,creek.test.hamcrest,creek.kafka.streams.test --add-opens org.junitpioneer/org.junitpioneer.jupiter=org.junit.platform.commons \ No newline at end of file diff --git a/.creek/service_template/root.package b/.creek/service_template/root.package index 7bca13e..c942afe 100644 --- a/.creek/service_template/root.package +++ b/.creek/service_template/root.package @@ -1 +1 @@ -io.github.creek.service.basic.kafka.streams.demo +io.github.creek.service.connected.services.demo diff --git a/.creek/service_template/services/src/main/java/io/github/creek/service/basic/kafka/streams/demo/services/ExampleServiceDescriptor.java b/.creek/service_template/services/src/main/java/io/github/creek/service/connected/services/demo/services/ExampleServiceDescriptor.java similarity index 84% rename from .creek/service_template/services/src/main/java/io/github/creek/service/basic/kafka/streams/demo/services/ExampleServiceDescriptor.java rename to .creek/service_template/services/src/main/java/io/github/creek/service/connected/services/demo/services/ExampleServiceDescriptor.java index 8579a7b..24ba941 100644 --- a/.creek/service_template/services/src/main/java/io/github/creek/service/basic/kafka/streams/demo/services/ExampleServiceDescriptor.java +++ b/.creek/service_template/services/src/main/java/io/github/creek/service/connected/services/demo/services/ExampleServiceDescriptor.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package io.github.creek.service.basic.kafka.streams.demo.services; +package io.github.creek.service.connected.services.demo.services; -import static io.github.creek.service.basic.kafka.streams.demo.internal.TopicDescriptors.inputTopic; +import static io.github.creek.service.connected.services.demo.internal.TopicDescriptors.inputTopic; import java.util.ArrayList; import java.util.Collection; import java.util.List; -import io.github.creek.service.basic.kafka.streams.demo.api.BasicKafkaStreamsDemoAggregateDescriptor; -import io.github.creek.service.basic.kafka.streams.demo.internal.TopicConfigBuilder; +import io.github.creek.service.connected.services.demo.api.ConnectedServicesDemoAggregateDescriptor; +import io.github.creek.service.connected.services.demo.internal.TopicConfigBuilder; import org.creekservice.api.kafka.metadata.OwnedKafkaTopicInput; import org.creekservice.api.kafka.metadata.OwnedKafkaTopicOutput; import org.creekservice.api.platform.metadata.ComponentInput; @@ -40,7 +40,7 @@ public ExampleServiceDescriptor() {} @Override public String dockerImage() { - return "ghcr.io/creek-service/basic-kafka-streams-demo-example-service"; + return "ghcr.io/creek-service/connected-services-demo-example-service"; } @Override diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index 05d904a..0000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1 +0,0 @@ -* @creek-service/code-reviewers \ No newline at end of file diff --git a/README.md b/README.md index 3f52fee..ae582eb 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,15 @@ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) -[![Coverage Status](https://coveralls.io/repos/github/creek-service/basic-kafka-streams-demo/badge.svg?branch=main)](https://coveralls.io/github/creek-service/basic-kafka-streams-demo?branch=main) -[![build](https://github.com/creek-service/basic-kafka-streams-demo/actions/workflows/build.yml/badge.svg)](https://github.com/creek-service/basic-kafka-streams-demo/actions/workflows/build.yml) -[![CodeQL](https://github.com/creek-service/basic-kafka-streams-demo/actions/workflows/codeql.yml/badge.svg)](https://github.com/creek-service/basic-kafka-streams-demo/actions/workflows/codeql.yml) +[![Coverage Status](https://coveralls.io/repos/github/creek-service/connected-services-demo/badge.svg?branch=main)](https://coveralls.io/github/creek-service/connected-services-demo?branch=main) +[![build](https://github.com/creek-service/connected-services-demo/actions/workflows/build.yml/badge.svg)](https://github.com/creek-service/connected-services-demo/actions/workflows/build.yml) +[![CodeQL](https://github.com/creek-service/connected-services-demo/actions/workflows/codeql.yml/badge.svg)](https://github.com/creek-service/connected-services-demo/actions/workflows/codeql.yml) # Basic Kafka Streams Demo -Repo containing the completed [Basic Kafka Streams demo](https://www.creekservice.org/basic-kafka-streams-demo) +Repo containing the completed [Basic Kafka Streams demo](https://www.creekservice.org/connected-services-demo) and associated [docs](docs/README.md). This repository is also a template repository to enable later tutorials, that build on this one. -Click the [Use this template](https://github.com/creek-service/basic-kafka-streams-demo/generate) button at the top to create a new repository from this template. +Click the [Use this template](https://github.com/creek-service/connected-services-demo/generate) button at the top to create a new repository from this template. ### Gradle commands diff --git a/api/src/main/java/io/github/creek/service/basic/kafka/streams/demo/api/BasicKafkaStreamsDemoAggregateDescriptor.java b/api/src/main/java/io/github/creek/service/connected/services/demo/api/ConnectedServicesDemoAggregateDescriptor.java similarity index 89% rename from api/src/main/java/io/github/creek/service/basic/kafka/streams/demo/api/BasicKafkaStreamsDemoAggregateDescriptor.java rename to api/src/main/java/io/github/creek/service/connected/services/demo/api/ConnectedServicesDemoAggregateDescriptor.java index fe62fe2..b6b5942 100644 --- a/api/src/main/java/io/github/creek/service/basic/kafka/streams/demo/api/BasicKafkaStreamsDemoAggregateDescriptor.java +++ b/api/src/main/java/io/github/creek/service/connected/services/demo/api/ConnectedServicesDemoAggregateDescriptor.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.github.creek.service.basic.kafka.streams.demo.api; +package io.github.creek.service.connected.services.demo.api; import java.util.ArrayList; import java.util.Collection; @@ -23,12 +23,12 @@ import org.creekservice.api.platform.metadata.ComponentInput; import org.creekservice.api.platform.metadata.ComponentOutput; -public final class BasicKafkaStreamsDemoAggregateDescriptor implements AggregateDescriptor { +public final class ConnectedServicesDemoAggregateDescriptor implements AggregateDescriptor { private static final List INPUTS = new ArrayList<>(); private static final List OUTPUTS = new ArrayList<>(); - public BasicKafkaStreamsDemoAggregateDescriptor() {} + public ConnectedServicesDemoAggregateDescriptor() {} @Override public Collection inputs() { diff --git a/api/src/main/java/io/github/creek/service/basic/kafka/streams/demo/internal/TopicConfigBuilder.java b/api/src/main/java/io/github/creek/service/connected/services/demo/internal/TopicConfigBuilder.java similarity index 98% rename from api/src/main/java/io/github/creek/service/basic/kafka/streams/demo/internal/TopicConfigBuilder.java rename to api/src/main/java/io/github/creek/service/connected/services/demo/internal/TopicConfigBuilder.java index 6a5448b..4e4a7f5 100644 --- a/api/src/main/java/io/github/creek/service/basic/kafka/streams/demo/internal/TopicConfigBuilder.java +++ b/api/src/main/java/io/github/creek/service/connected/services/demo/internal/TopicConfigBuilder.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.github.creek.service.basic.kafka.streams.demo.internal; +package io.github.creek.service.connected.services.demo.internal; import static java.util.Objects.requireNonNull; diff --git a/api/src/main/java/io/github/creek/service/basic/kafka/streams/demo/internal/TopicDescriptors.java b/api/src/main/java/io/github/creek/service/connected/services/demo/internal/TopicDescriptors.java similarity index 99% rename from api/src/main/java/io/github/creek/service/basic/kafka/streams/demo/internal/TopicDescriptors.java rename to api/src/main/java/io/github/creek/service/connected/services/demo/internal/TopicDescriptors.java index 42093f0..81879be 100644 --- a/api/src/main/java/io/github/creek/service/basic/kafka/streams/demo/internal/TopicDescriptors.java +++ b/api/src/main/java/io/github/creek/service/connected/services/demo/internal/TopicDescriptors.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.github.creek.service.basic.kafka.streams.demo.internal; +package io.github.creek.service.connected.services.demo.internal; import static java.util.Objects.requireNonNull; import static org.creekservice.api.kafka.metadata.SerializationFormat.serializationFormat; diff --git a/api/src/main/java/module-info.java b/api/src/main/java/module-info.java index bf79d53..6c1f04b 100644 --- a/api/src/main/java/module-info.java +++ b/api/src/main/java/module-info.java @@ -1,8 +1,8 @@ -module basic.kafka.streams.demo.api { +module connected.services.demo.api { requires transitive creek.kafka.metadata; - exports io.github.creek.service.basic.kafka.streams.demo.api; - exports io.github.creek.service.basic.kafka.streams.demo.internal to - basic.kafka.streams.demo.services, - basic.kafka.streams.demo.service; + exports io.github.creek.service.connected.services.demo.api; + exports io.github.creek.service.connected.services.demo.internal to + connected.services.demo.services, + connected.services.demo.service; } diff --git a/api/src/test/java/io/github/creek/service/basic/kafka/streams/demo/internal/TopicConfigBuilderTest.java b/api/src/test/java/io/github/creek/service/connected/services/demo/internal/TopicConfigBuilderTest.java similarity index 98% rename from api/src/test/java/io/github/creek/service/basic/kafka/streams/demo/internal/TopicConfigBuilderTest.java rename to api/src/test/java/io/github/creek/service/connected/services/demo/internal/TopicConfigBuilderTest.java index 4bc509b..dd19717 100644 --- a/api/src/test/java/io/github/creek/service/basic/kafka/streams/demo/internal/TopicConfigBuilderTest.java +++ b/api/src/test/java/io/github/creek/service/connected/services/demo/internal/TopicConfigBuilderTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.github.creek.service.basic.kafka.streams.demo.internal; +package io.github.creek.service.connected.services.demo.internal; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.hasEntry; diff --git a/api/src/test/java/io/github/creek/service/basic/kafka/streams/demo/internal/TopicDescriptorsTest.java b/api/src/test/java/io/github/creek/service/connected/services/demo/internal/TopicDescriptorsTest.java similarity index 90% rename from api/src/test/java/io/github/creek/service/basic/kafka/streams/demo/internal/TopicDescriptorsTest.java rename to api/src/test/java/io/github/creek/service/connected/services/demo/internal/TopicDescriptorsTest.java index d008cf3..394e65d 100644 --- a/api/src/test/java/io/github/creek/service/basic/kafka/streams/demo/internal/TopicDescriptorsTest.java +++ b/api/src/test/java/io/github/creek/service/connected/services/demo/internal/TopicDescriptorsTest.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.github.creek.service.basic.kafka.streams.demo.internal; +package io.github.creek.service.connected.services.demo.internal; -import static io.github.creek.service.basic.kafka.streams.demo.internal.TopicDescriptors.KAFKA_FORMAT; -import static io.github.creek.service.basic.kafka.streams.demo.internal.TopicDescriptors.creatableInternalTopic; -import static io.github.creek.service.basic.kafka.streams.demo.internal.TopicDescriptors.inputTopic; -import static io.github.creek.service.basic.kafka.streams.demo.internal.TopicDescriptors.internalTopic; -import static io.github.creek.service.basic.kafka.streams.demo.internal.TopicDescriptors.outputTopic; +import static io.github.creek.service.connected.services.demo.internal.TopicDescriptors.KAFKA_FORMAT; +import static io.github.creek.service.connected.services.demo.internal.TopicDescriptors.creatableInternalTopic; +import static io.github.creek.service.connected.services.demo.internal.TopicDescriptors.inputTopic; +import static io.github.creek.service.connected.services.demo.internal.TopicDescriptors.internalTopic; +import static io.github.creek.service.connected.services.demo.internal.TopicDescriptors.outputTopic; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.sameInstance; diff --git a/api/src/test/java/module-info.test b/api/src/test/java/module-info.test index 0206dc0..1cb1e4b 100644 --- a/api/src/test/java/module-info.test +++ b/api/src/test/java/module-info.test @@ -2,7 +2,7 @@ org.junitpioneer,org.hamcrest,guava.testlib,creek.test.util,creek.test.hamcrest --add-reads - basic.kafka.streams.demo.api=org.junitpioneer,org.hamcrest,guava.testlib,creek.test.util,creek.test.hamcrest + connected.services.demo.api=org.junitpioneer,org.hamcrest,guava.testlib,creek.test.util,creek.test.hamcrest --add-opens org.junitpioneer/org.junitpioneer.jupiter=org.junit.platform.commons \ No newline at end of file diff --git a/docs/.gitignore b/docs/.gitignore deleted file mode 100644 index 34a2c9f..0000000 --- a/docs/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -# Apple -**/.DS_Store - -# Ruby Gem -*.gem -.bundle -Gemfile.lock -**/vendor/bundle - -# Jekyll generated files -.jekyll-cache -.jekyll-metadata -.sass-cache -_asset_bundler_cache -_site \ No newline at end of file diff --git a/docs/Gemfile b/docs/Gemfile deleted file mode 100644 index 0c0a943..0000000 --- a/docs/Gemfile +++ /dev/null @@ -1,9 +0,0 @@ -source "https://rubygems.org" - -gem "jekyll", "~> 4.3" -gem "creek-jekyll-theme", "~> 1.0" - -# # If you have any plugins, put them here! -group :jekyll_plugins do - gem 'jekyll-include_snippet', "~> 0.2" # https://github.com/tomdalling/jekyll-include_snippet -end diff --git a/docs/README.md b/docs/README.md deleted file mode 100644 index 1aa35d2..0000000 --- a/docs/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# Repos GitHub pages site. - -## Setup - -If you want to hack about with the site or add content, then follow these instructions to be able to run locally. - -### Prerequisites - -1. Install Git, obviously. -2. [Install Jekyll](https://jekyllrb.com/docs/installation) -3. Install [Builder](https://bundler.io/) by running `gem install bundler`. - -### Installing - -#### 1. Install the gems - -```shell -cd docs -bundle install -``` - -#### 2. Update - -Occasionally update gems - -```shell -git checkout main -git pull -bundle update -git checkout -b gems-update -git add . -git commit -m "updating gems" -git push --set-upstream origin gems-update -``` - -#### 3. Run the local server - -```shell -(cd docs && bundle exec jekyll serve --livereload --baseurl /basic-kafka-streams-demo) -``` - -This will launch a web server so that you can work on the site locally. -Check it out on [http://localhost:4000/basic-kafka-streams-demo](http://localhost:4000/basic-kafka-streams-demo). diff --git a/docs/_config.dev.yml b/docs/_config.dev.yml deleted file mode 100644 index 45df3df..0000000 --- a/docs/_config.dev.yml +++ /dev/null @@ -1,13 +0,0 @@ -# Develop override settings - -url: http://localhost:4000 - -analytics: - provider: false - -comments: - disqus: - shortname : "mmistakes-dev" - -sass: - style: expanded \ No newline at end of file diff --git a/docs/_config.yml b/docs/_config.yml deleted file mode 100644 index 5aa516f..0000000 --- a/docs/_config.yml +++ /dev/null @@ -1,51 +0,0 @@ - -# Welcome to Jekyll! -# -# This config file is meant for settings that affect your entire site, values -# which you are expected to set up once and rarely need to edit after that. -# For technical reasons, this file is *NOT* reloaded automatically when you use -# `jekyll serve`. If you change this file, please restart the server process. - -# Site Settings -theme : "creek-jekyll-theme" -baseurl : "/basic-kafka-streams-demo" -repository: "creek-service/basic-kafka-streams-demo" - -# Reading Files -include: - - .htaccess - - _pages -exclude: - - README.md - -# Collections -collections: - demo: - output: true - permalink: /:collection/:path - -# Defaults -defaults: - # _pages - - scope: - path: "_pages" - type: pages - values: - layout: single - author_profile: false - toc: true - toc_sticky: true - # _demo - - scope: - path: "" - type: demo - values: - layout: single - read_time: false - author_profile: false - share: false - comments: false - sidebar: - nav: demo - toc: false - toc_sticky: true \ No newline at end of file diff --git a/docs/_data/navigation/demo.yml b/docs/_data/navigation/demo.yml deleted file mode 100644 index 04c3bbd..0000000 --- a/docs/_data/navigation/demo.yml +++ /dev/null @@ -1,30 +0,0 @@ -- title: "Getting Started" - children: - - title: "Introduction" - url: / - - title: "Bootstrap a new repository" - url: /bootstrap - - title: "Add a microservice" - url: /add-service -- title: "Write the code" - children: - - title: "Service descriptor" - url: /descriptor - - title: "Business logic" - url: /business-logic -- title: Testing - children: - - title: "System tests" - url: /system-testing - - title: "Code coverage" - url: /system-testing-coverage - - title: "Unit tests" - url: /unit-testing - - title: "Debugging" - url: /debugging -- title: Next steps - children: - - title: "Deployment" - url: /deployment -# - title: "Further reading" -# url: /further-reading diff --git a/docs/_demo/01-intro.md b/docs/_demo/01-intro.md deleted file mode 100644 index a6a76a2..0000000 --- a/docs/_demo/01-intro.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -title: Basic Kafka Streams demo -permalink: / -layout: single -toc: true ---- - -This tutorial will lead you through building a simple Kafka Streams based microservice that consumes a -Kafka topic containing tweets and extracts the usage of Twitter handles, e.g. `@elonmusk`, from the Tweet text, -producing usage counts to another topic. - -**Note:** This is a deliberately simplistic service, allowing the tutorial to focus on demonstrating Creek's core features. -{: .notice--warning} - -## Features covered - -By the end of this tutorial you should know: - * How to bootstrap a new repo from the [aggregate-template][aggTemp] repository. - * How to define a service descriptor: metadata about the API of a service. - * How to obtain a `kafka` topic's serde, for use in a Kafka Streams topologies. - * How to build and execute a Kafka Streams topology, using Creek. - * How to write black-box system tests of the service's Docker image. - * How to write unit tests of the service's topology. - * How to debug a service, running in a Docker container, when things aren't working as expected. - * How to capture code-coverage metrics. - * How Creek enables all of the above to accelerate Microservice development, - allowing you to focus on business logic, not boilerplate. - -## Prerequisites - -The tutorial requires the following: - -* A [GitHub](https://github.com/join) account. -* [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) installed for source code control. -* [Docker desktop](https://docs.docker.com/desktop/) installed for running containerised system tests. -* (Optional) [IntelliJ IDE](https://www.jetbrains.com/help/idea/installation-guide.html) installed for code development. -* (Optional) [AttachMe IntelliJ plugin](https://plugins.jetbrains.com/plugin/13263-attachme) installed for debugging containerised services. - -## Design - -To keep things simple, this example design assumes an upstream gateway service is consuming tweets from the Twitter api, -and producing records to a Kafka topic named `twitter.tweet.text`. -The produced records have the tweet id in the key and the tweet text in the value. - -In a normal system, the upstream gateway service would likely _own_ its `twitter.tweet.text` output topic. -To keep this tutorial self-contained, the tutorial's service will _own_ its `twitter.tweet.text` input topic. - -**ProTip:** The concept of topic _ownership_ defines which service / aggregate, and hence team, within an organisation -is responsible for the topic, its configuration, and the data it contains. -{: .notice--info} - -{% include figure image_path="/assets/images/creek-demo-design.svg" alt="Service design" %} - -The service will search each tweet for Twitter handles, e.g. `@BarackObama`. For each handle, the service will produce -a record to the `twitter.handle.usage` Kafka topic. -The produced records have the Twitter handle in the key and the number of occurrences in the value. - -## Complete solution - -The completed tutorial can be viewed [on GitHub][demoOnGh]. - -[  View on GitHub][demoOnGh]{: .btn .btn--success} - - -[aggTemp]: https://github.com/creek-service/aggregate-template -[demoOnGh]: https://github.com/creek-service/basic-kafka-streams-demo \ No newline at end of file diff --git a/docs/_demo/02-bootstrap-repo.md b/docs/_demo/02-bootstrap-repo.md deleted file mode 100644 index 97d6bf2..0000000 --- a/docs/_demo/02-bootstrap-repo.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -title: Bootstrap a new aggregate -permalink: /bootstrap -description: Learn how to use the Creek aggregate template to bootstrap your own Git repository for hosting Microservices -layout: single ---- - -Step 1 is to create a new GitHub aggregate repository, into which we'll add our service. - -**ProTip:** An _aggregate_ is simply a logical grouping of services that, together, provide some business function -via a defined api. i.e. An aggregate is a level of abstraction above a single microservice. -This is also known as a ['Bounded Context' in DDD nomenclature][bcDDD]. -{: .notice--info} - -Rather than manually creating a new repository and performing all the lengthy project setup, -we can use the [aggregate-template][templateDocs] repository. -This will create a new repository with all the plumbing and boilerplate code in place. - -## Creating a new repository from the template - -1. Click [  Create new aggregate][aggTempNew]{: .btn .btn--success} and fill in the details: - {% include figure image_path="/assets/images/creek-create-new-from-agg-template.png" alt="Create new aggregate repo" %} - -2. When GitHub creates the new repo, a [boostrap workflow][bootstrapWorkflow] will run to customise the new repository. - Wait for this workflow to complete in the _Actions_ tab: - {% include figure image_path="/assets/images/creek-repo-bootstrap.png" alt="Wait for boostrap workflow" %} - -3. [Clone the new repository][cloneRepo] locally. -4. Finish the initialisation of the repository by running the `clean_up.sh` script from the root of the repository. - - ``` - ./.creek/clean_up.sh - ``` - - The clean-up script will finish off the customisation of the new repository, removing now redundant workflows, - scripts and code. - -5. Commit the changes back to the GitHub - ``` - git add -A - git commit -m "clean_up script" - git push - ``` - -The repository is now ready for services to be added, which will be covered in the next step. - -More information about the features and structure of the repository can be found -in the [aggregate template documentation][templateDocs]. - -[aggTempNew]: https://github.com/creek-service/aggregate-template/generate -[bootstrapWorkflow]: https://github.com/creek-service/aggregate-template/blob/main/.github/workflows/bootstrap.yml -[cloneRepo]: https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository -[templateDocs]: https://www.creekservice.org/aggregate-template -[bcDDD]: https://martinfowler.com/bliki/BoundedContext.html \ No newline at end of file diff --git a/docs/_demo/03-add-service.md b/docs/_demo/03-add-service.md deleted file mode 100644 index d566374..0000000 --- a/docs/_demo/03-add-service.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -title: Add a microservice -permalink: /add-service -description: Learn how to use the Creek aggregate template to quickly add new microservices to your aggregate repositories -layout: single ---- - -With a fresh new repository ready for use, the next step is to add a service module to the repository - -**ProTip:** Each microservice has its own Gradle subproject a.k.a. module. -{: .notice--info} - -Setting up a new service manually can be a lengthy process. -Luckily, the `aggregate-tempalate` comes with an automated way of adding a new service using a GitHub workflow: - -1. Go to the `Actions` tab of the new repository on GitHub. -2. Select `Add service module` from the list of available workflows on the left. -3. Click the `Run workflow ▾` button and enter the service name as `handle-occurrence-service`: - {% include figure image_path="/assets/images/creek-add-service.png" alt="Add new service" %} - - **Note:** Service names must be lowercase. Only alphanumerics and dashes are supported. - {: .notice--warning} - - **ProTip:** End your service names with `-service` to make it clear the module contains a microservice. - {: .notice--info} -4. Click the [Run workflow](){: .btn .btn--small .btn--disabled .btn--success} button below the service name. - -This will kick off a workflow that adds the new module, containing the boilerplate code for a new service, -though you may need to refresh the web page to view it. - -Wait for the workflow to complete and pull down the changes to your local machine by running: - -```shell -git pull -``` diff --git a/docs/_demo/04-service-descriptor.md b/docs/_demo/04-service-descriptor.md deleted file mode 100644 index 5b7a2fb..0000000 --- a/docs/_demo/04-service-descriptor.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -title: Define the service's resources -permalink: /descriptor -description: Learn how to write a Creek service descriptor, which defines metadata about a microservice and the external resources it uses. -layout: single -snippet_comment_prefix: "//" -snippet_source: "../services/src/main/java/io/github/creek/service/basic/kafka/streams/demo/services/HandleOccurrenceServiceDescriptor.java" ---- - -Each service within an aggregate defines a _service descriptor_ in the `services` module of the repository. - -A _service descriptor_ defines the external resources a service uses and the api it exposes. -The types of resources a descriptor can reference depends on the installed [Creek extensions][creekExts]. - -**ProTip:** Service descriptors are accessible by other services within the aggregate, but not by those outside. -Services from other aggregates should only use the aggregate's public API defined in an [aggregate descriptor][aggDescriptor]. -{: .notice--info} - -This demo will use the [Kafka Streams extension][ksExt], and the `handle-occurrence-service`'s descriptor will define a -`twitter.tweet.text` _input topic_, which the service will consume, and a `twitter.handle.usage` _output topic_, -which the service will produces to. - -**Note:** To keep this tutorial self-contained, the service's input topic is _owned_ by the service. -It would be more common for an upstream service or aggregate to own the topic and for the topic's -definition to be imported from there. This will be covered in a later tutorial. -{: .notice--warning} - -[todo]: http:// update note above with link to the tutorial on linking aggregates together. - -## Define the topic resources - -The aggregate template provided a shell service descriptor in the repository named `HandleOccurrenceServiceDescriptor.java`. -Add the following to the class to define the service's input and output topics: - -{% highlight java %} -{% include_snippet includes-1 %} - -{% include_snippet includes-2 %} - -{% include_snippet class-name %} - -{% include_snippet topic-resources %} - - ... -} -{% endhighlight %} - - -The two class constants define the input and output topics the services use. -These constants will be used later when building the Kafka Streams topology. - -Each topic definition includes the topic name, the types stored in the topic's records' key and value, -and the topic config, which in this case is just the number of partitions. - -The `register` method wrapping each resource descriptor ensures they are registered with the outer service descriptor. - -**Note:** The [system tests]({{ "/system-testing" | relative_url}}) we'll define later will use the service descriptor -to discover the service metadata required to run the service, pipe in inputs and read outputs. -{: .notice--warning} - -[creekExts]: https://www.creekservice.org/extensions/ -[ksExt]: https://github.com/creek-service/creek-kafka -[aggDescriptor]: https://www.creekservice.org/docs/descriptors/#aggregate-descriptor -[todo]: switch about links to proper creekservice.org links once each repo publishes docs. diff --git a/docs/_demo/05-business-logic.md b/docs/_demo/05-business-logic.md deleted file mode 100644 index f2acb3b..0000000 --- a/docs/_demo/05-business-logic.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: Write the business logic -permalink: /business-logic -description: Learn how to add your business logic to Kafka Streams microservices created using the Creek aggregate template -layout: single -snippet_comment_prefix: "//" -snippet_source: "../handle-occurrence-service/src/main/java/io/github/creek/service/basic/kafka/streams/demo/service/kafka/streams/TopologyBuilder.java" ---- - -With the topic resources defined in the last step, it's time to write a simple [Kafka Streams][kafkaStreams] -topology to perform the business logic of this service. - -The service will search each tweets text for occurrences of Twitter handles, e.g. `@katyperry`. -For each handle found, it will produce a record mapping the Twitter handle to its number of occurrences. -For example, it a tweet contained the handle `@katyperry` twice, then it would produce a record -with a key of `@katyperry` and a value of `2`. - -## Define the stream topology - -The aggregate template provided a shell `TopologyBuilder` class. -Flesh out the class's `build` method to match what's below: - -{% highlight java %} -{% include_snippet build-method %} -{% endhighlight %} - -The above topology consumes `TweetTextTopic` we defined in the service's descriptor, -transforms it in the `extractHandles` method, -and produces any output to the `TweetHandleUsageTopic`. - -As a single input record can result in zero or more output records, depending on the occurrences of Twitter handles in the tweet text, -we use the `flatMap` method to invoke the `extractHandles` method. - -The details of the `extractHandles` method is particularly important in the context of demonstrating Creek's functionality. -A simple solution might look like this: - -{% highlight java %} -{% include_snippet extract-method %} -{% endhighlight %} - -...and that's the production code of the service complete! - -**ProTip:** The `Name` instance defined in the `TopologyBuilder` doesn't add much in this example, but as topologies -get more complex, getting broken down into multiple builder classes, it really comes into its own. -Check out its JavaDoc to see how it can be used to help avoid topology node name clashes. -{: .notice--info} - -[todo]: https:// add link to the classes java doc once published to the above tip. - -[kafkaStreams]: https://kafka.apache.org/documentation/streams/ \ No newline at end of file diff --git a/docs/_demo/06-system-testing.md b/docs/_demo/06-system-testing.md deleted file mode 100644 index eb118e7..0000000 --- a/docs/_demo/06-system-testing.md +++ /dev/null @@ -1,138 +0,0 @@ ---- -title: Writing system tests -permalink: /system-testing -description: Learn how to write YAML based system tests that test the functionality of your microservice running in Docker containers -layout: single -toc: true ---- - -With the production code complete, let's look at adding some tests. - -Creek [system-tests][systemTests] perform black-box testing of your service or services. -It executes test suites against your complete services, and any required third-party services, running in a Docker containers. - -The Docker images being run are the same images you'll deploy into your environments. -By testing the actual Docker image, you can be confident the service does what is intended, -always assuming that your test coverage is sufficient. - -## Write a system test - -System tests are written in YAML files, and executed as part of the Gradle build using the -[system test plugin][testPlugin]. The repo already has a `system-tests` module, with the plugin applied. -Follow these steps to add a test suite to the module: - -**ProTip:** The `systemm-test` plugin can be applied to individual service modules, allowing for targeted testing -of a single service, or more normally applied to a `system-tests` module, where the functionality of the aggregate -as a whole can be tested. -{: .notice--info} - -### Define test inputs - -Start by defining the input to send to the service, i.e. the records to produce to the `twitter.tweet.text` Kafka topic. -These will be produced to the topic _after_ the service has started up. - -**ProTip:** Input data can also be seeded into the test environment _before_ services are started, by placing -the input file in the `seed` directory, rather than the `inputs` directory. -{: .notice--info} - -Create a file at `system-tests/src/system-test/example-suite/inputs/twitter.tweet.text.yml` with the following content: - -{% highlight yaml %} -{% include_snippet all from ../system-tests/src/system-test/example-suite/inputs/twitter.tweet.text.yml %} -{% endhighlight %} - -**ProTip:** The name of the file does not need to match the name of the topic, it can be anything. -Name the file to make the test cases easy to understand. -{: .notice--info} - -The `!creek/kafka-topic@1` at the top of the file tells the system test parser how to parse this file. -This particular input type is registered by the [Creek Kafka test extension][kafkaTestExt]. -The number after the `@` symbol is a version number, allowing the type to evolve without breaking existing tests. - -The `records` property defines the list of records the system tests will produce to Kafka, with each record's `key` and `value` defined. - -**ProTip:** You can define records with `null` keys and values implicitly by excluding the `key` and/or `value` property, -or explicitly by setting the `key` and/or `value` property to `~`. -{: .notice--info} - -### Define expected outputs - -Given the input above, define the expected output, i.e. the records we expect the service to produce to the -`twitter.handle.usage` topic. - -Create a file at `system-tests/src/system-test/example-suite/expectations/twitter.handle.usage.yml` with the following content: - -{% highlight yaml %} -{% include_snippet all from ../system-tests/src/system-test/example-suite/expectations/twitter.handle.usage.yml %} -{% endhighlight %} - -This file follows a similar format to the _input_ file, defining the type the file should be parsed as, and -the exact records to expect. - -**ProTip:** You can define expectations of records with `null` keys and values by setting the `key` and/or `value` property to `~`. -Unlike for inputs and seeds, not defining the `key` or `value` property in an expectation file means the property is ignored. -Any value is accepted as valid, though it will still need to deserialise correctly. -{: .notice--info} - -### Add a test suite file - -With the test input and expected output defined, it's time to define the test suite. - -Create a file at `system-tests/src/system-test/example-suite/suite.yml` with the following content: - -{% highlight yaml %} -{% include_snippet all from ../system-tests/src/system-test/example-suite/suite.yml %} -{% endhighlight %} - -This defines a very basic test suite, which starts our `handle-occurrence-service` and executes a single test case. -That test case feeds in the records in the `twitter.tweet.text` YAML file, and expects the output in the `twitter.handle.usage` YAML file. - -**Protip:** The `.yml` extension of files listed under a test's `inputs` and `outputs` property is optional. -{: .notice--info} - -**Protip:** A test suite can define `options` to customise the test suite. For example, the Kafka test extension defines -a [`creek/kafka-options`][kafkaOptions] type. -{: .notice--info} - -[todo]: add protip about customising additional record handling, ordering etc, using `creek/kafka-options@1`. - - -## Running the system tests - -The system tests can be executed with the following Gradle command: - -``` -./gradlew systemTest -``` - -The system tests will start up a Kafka broker, and the `handle-occurrence-service`, in Docker containers. Once running, -it will produce the records defined in the `twitter.tweet.text.yml` to Kafka and listen for the expected output defined -in the `twitter.handle.usage.yml` file. - -**Note:** All being well the tests will pass! Why not try changing the expected output and re-running to see what -happens when tests fail. The system tests output a lot of information about failures. -{: .notice--success} - -## How do the system tests work? - -We believe that being able to test the business functionality of a service, or services, this quickly and easily is -both pretty cool and a big part of what drove us to develop Creek, but how does it work? - -Very briefly, the system tests work by discovering the `handle-occurrence-service`'s service descriptor on the class path. -The system tests inspect the service descriptor. - -As the descriptor defines Kafka based resources, the system tests, with the help of the installed [Creek Kafka system-test extension][kafkaTestExt], -knows to start a Kafka broker and create any unowned topics. - -The service descriptor also defines the name of the service's Docker container, allowing the system tests to start the service. - -Finally, the Kafka topic descriptors exposed by the service descriptor provide the information the system tests, and its extensions, -need to be able to serialize inputs and deserialize outputs. - -More information about the system tests can be found [here][systemTests]. - -[systemTests]:https://github.com/creek-service/creek-system-test -[testPlugin]: https://github.com/creek-service/creek-system-test-gradle-plugin -[kafkaTestExt]: https://github.com/creek-service/creek-kafka/tree/main/test-extension -[kafkaOptions]: https://github.com/creek-service/creek-kafka/tree/main/test-extension#option-model-extensions -[todo]: switch about links to proper creekservice.org links once each repo publishes docs. diff --git a/docs/_demo/07-code coverage.md b/docs/_demo/07-code coverage.md deleted file mode 100644 index e4f5633..0000000 --- a/docs/_demo/07-code coverage.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: System test coverage -permalink: /system-testing-coverage -description: Learn how Creek captures code coverage metrics when running system test, which test your service running in a Docker container -layout: single ---- - -Creek captures code coverage metrics from your service, running inside the Docker container, when running the system -tests. It does this by leveraging the [JaCoCo Gradle plugin][JaCoCoPlugin] and some smarts to configure the service -running in the Docker container. - -Test coverage is calculated by running the following Gradle command: - -``` -./gradlew coverage -``` - -The human-readable coverage report is saved to `build/reports/jacoco/coverage/html/index.html`. - -{% include figure image_path="/assets/images/creek-system-test-coverage.png" alt="System test coverage" %} - -With just the system tests, the test coverage is pretty good for our new service. -The only think really missing is coverage of the `io.github.creek.service.basic.kafka.streams.demo.api` package, -and that is because we've not yet looked at utilising the aggregate descriptor defined in that package. -The aggregate descriptor defines the API for the aggregate, one abstraction level up from services, and will be covered in a later tutorial. - -[todo]: which tutorial? - -In the next step, we will add unit tests. However, with good system test coverage we recommend that unit testing -is limited to testing edge cases that are hard, or impossible, to test using the system tests. Use system testing -to test both the happy and error paths of your business logic. - -[JaCoCoPlugin]: https://docs.gradle.org/current/userguide/jacoco_plugin.html - diff --git a/docs/_demo/08-unit-testing.md b/docs/_demo/08-unit-testing.md deleted file mode 100644 index b029ef7..0000000 --- a/docs/_demo/08-unit-testing.md +++ /dev/null @@ -1,100 +0,0 @@ ---- -title: Writing unit tests -permalink: /unit-testing -description: Learn how Creek simplifies writing Kafka Streams topology unit tests. -layout: single -snippet_comment_prefix: "//" -snippet_source: "../handle-occurrence-service/src/test/java/io/github/creek/service/basic/kafka/streams/demo/service/kafka/streams/TopologyBuilderTest.java" -toc: true ---- - -Secondary to system testing, it can be useful to unit test a topology. -With good system test coverage this may not be necessary. If it is needed, then Creek can help. - -The [creek-kafka-streams-test][ksTest] library provides topology test helpers: `TestKafkaStreamsExtensionOptions` -can be used to initialise Creek without a real Kafka cluster to talk to, and `TestTopics` provides some factory -methods for creating the test topic instances used in the unit test. - -## Add a unit test - -The aggregate template provided a shell `TopologyBuilderTest` class. -To add a basic unit test, add the code below to the class: - -{% highlight java %} -{% include_snippet includes %} -// ... - -{% include_snippet class-declaration %} - // ... - -{% include_snippet topic-declarations %} - // ... - -{% include_snippet setUp %} - -{% include_snippet unit-test %} - // ... -} -{% endhighlight %} - -The above adds a single `shouldOutputHandleOccurrences` unit test for our simple topology, -which produces a single record to the topologies input topic, and asserts the output is correct. - -## Topology test - -The eagle-eyed of you may have noticed an existing test at the bottom of `TopologyBuilderTest` called `shouldNotChangeTheTopologyUnintentionally`. -The intent of this test is to detect any unintentional changes to the Kafka Streams topology. - -**Warning:** There are certain categories of topology changes that are not backwards compatible with earlier versions -of a deployed service, e.g. those that change topic names. -Creek recommends always naming operators in the Kafka Streams DSL to minimise the chance of unintentional changes to internal topics. -See the [Kafka Streams docs][kafkaStreams] for more information. -{: .notice--warning} - -The test compares the topology with the last know topology and fails if they differ. -If the change is intentional, then the `handle-occurrence-service/src/test/resources/kafka/streams/expected_topology.txt` -file can be updated to reflect the latest topology. For this tutorial, the file should be updated to contain: - -``` -Topologies: - Sub-topology: 0 - Source: ingest-twitter.tweet.text (topics: [twitter.tweet.text]) - --> extract-handles - Processor: extract-handles (stores: []) - --> egress-twitter.handle.usage - <-- ingest-twitter.tweet.text - Sink: egress-twitter.handle.usage (topic: twitter.handle.usage) - <-- extract-handles -``` -[todo]: update the above to %include% the actual expectations file, once include_raw exists. - -If you find this test more of a hindrance than a help... delete it! :smile: - -## Test Coverage - -As before, test coverage can be calculated by running the following Gradle command: - -``` -./gradlew coverage -``` - -This will execute the unit and system tests and use [JaCoCo][JaCoCo] to calculate the test coverage. -The human-readable coverage report is saved at `build/reports/jacoco/coverage/html/index.html`. - -{% include figure image_path="/assets/images/creek-unit-test-coverage.png" alt="Unit test coverage" %} - -In this case, the test coverage hasn't improved by adding unit tests. Meaning, arguably, this test is superfluous. - -While Creek recommends using system tests for functional testing, more complex real-world solutions often still -benefit from unit testing of the topology, to cover branches that are hard to reach with system tests. - -**ProTip:** The repository also has a Gradle task and GitHub workflow step to upload the coverage report to -[coveralls.io][coveralls], should this be something you need, or the project can be customised to publish -coverage reports elsewhere. -{: .notice--info} - -[coveralls]: https://coveralls.io/ -[kafkaStreams]: https://kafka.apache.org/33/documentation/streams/developer-guide/dsl-topology-naming.html -[JaCoCo]: https://github.com/jacoco/jacoco -[ksTest]: https://github.com/creek-service/creek-kafka/tree/main/streams-test -[todo]: update links above as docs move onto creekservice.org \ No newline at end of file diff --git a/docs/_demo/09-debugging.md b/docs/_demo/09-debugging.md deleted file mode 100644 index a6a8a8e..0000000 --- a/docs/_demo/09-debugging.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -title: Debugging services running in Docker containers -permalink: /debugging -description: Learn how the Creek aggregate template enables easy debugging of your microservice code running in a Docker container -layout: single ---- - -The Gradle plugin used to run the system tests supports the debugging of the services running inside Docker containers. -This makes debugging issues with system tests so much less painful. - -**Note:** Service debugging is currently only supported through the IntelliJ IDE. -If you're using another IDE, then please consider contributing to get service debugging working for your IDE. -{: .notice--warning} - -## Prerequisites - -Debugging of services currently requires the [AttachMe][attachMe] IntelliJ plugin to be installed. - -The `aggregate-template` repository has preconfigured the service to support debugging. - -**ProTip:** Details of what configuration is required, if you want to dig into the details, can be found in the -[creek-system-test][sysTestRequirements] and [system-test Gradle plugin][pluginRequirements] docs. -{: .notice--info} - -## Debugging a service - -With [AttachMe][attachMe] plugin installed, the `handle-occurrence-service` can be debugged with the following steps: - -1. Create and run an `AttachMe` run configuration. - {% include figure image_path="/assets/images/creek-create-attachme-run-config.png" alt="AttacheMe run configuration" %} -2. Name the new configuration, but leave the default port at the default `7857`. - {% include figure image_path="/assets/images/creek-attachme-run-config.png" alt="AttacheMe run configuration details" %} -3. Place the required breakpoints in the code. For example, place one in the `TopologyBuilder`'s `extractHandles()` - method. - {% include figure image_path="/assets/images/creek-add-breakpoint.png" alt="Add breakpoint" %} -4. Run the system tests, specifying which service to debug: - - ``` - ./gradlew systemTest \ - --debug-service="handle-occurrence-service" \ - --verification-timeout-seconds=9999 - ``` - -When the system tests start the `handle-occurrence-service` Docker container, the service will attach to the debugger. -This will cause a new debug window to open and for the breakpoint to be hit: - -{% include figure image_path="/assets/images/creek-breakpoint-hit.png" alt="Breakpoint hit" %} - -Pretty cool, right? - -**ProTip:** The `--verification-timeout-seconds` argument increases the amount of time the system tests wait -for the expected output, allowing more time to debug the code. Learn more on this, and other options, -in the [system test plugin][systemTestOptions] documentation. -{: .notice--info} - -[attachMe]: https://plugins.jetbrains.com/plugin/13263-attachme -[sysTestRequirements]: https://github.com/creek-service/creek-system-test#configuring-a-service-for-debugging -[pluginRequirements]: https://github.com/creek-service/creek-system-test-gradle-plugin#dependency-management -[systemTestOptions]: https://github.com/creek-service/creek-system-test-gradle-plugin#systemtest---systemtest -[todo]: update links below to point to creekservice.org as docs migrate. \ No newline at end of file diff --git a/docs/_demo/10-deployment.md b/docs/_demo/10-deployment.md deleted file mode 100644 index f211b3b..0000000 --- a/docs/_demo/10-deployment.md +++ /dev/null @@ -1,91 +0,0 @@ ---- -title: Deployment -permalink: /deployment -description: Learn the features of the Creek aggregate template that will help when it comes to deploying your microservices. -layout: single -toc: true ---- - -Deploying the service to an environment is outside the scope of this tutorial, and the steps will vary depending on -the type of environment. However, below is information you may file useful when the time comes to deploy your services. - -## Versioning - -Versioning is handled by the excellent [pl.allegro.tech.build.axion-release][releasePlugin] Gradle plugin. - -The aggregate template comes preconfigured to increment the patch version on each build. -This ensures each code change results in a new Docker image, with a unique version, being built. -Ensuring its easy to trace back a Docker image running in an environment, to the version of the code its running. - -See the [aggregate template docs][aggTempVersioning] for more info. - -## Docker Images - -### Building Docker images - -The repository comes preconfigured with the necessary tasks to build each service's Docker image using the -most excellent [com.bmuschko.docker-remote-api][dockerPlugin] Gradle plugin. -Run the following to build the docker image: - -``` -./gradlew buildAppImage -``` - -This will build a docker container named `ghcr.io/creek-service/basic-kafka-streams-demo-handle-occurrence-service`. - -**ProTip:** The Docker image name is defined both in the service's descriptor and the service's `buildAppImage` -Gradle task. These must be kept in sync if system tests are to work. -{: .notice--info} - -### Publishing Docker images - -The repository comes preconfigured to publish each service's Docker image back to GitHub's -[Container Registry][containerReg]. The publishing is done by the [CI GitHub workflow][buildYml] on a push, -with each new push creating a new Docker image version. - -For example, the `handle-occurrence-service` this tutorial creates is published [here][dockerPackage] by the [completed tutorial][demoGh] -[handle-occurrence-service-image]. - -Under the hood the workflow is using the `pushAppImage` Gradle task to push the Docker images: - -``` -./gradlew pushAppImage -``` - -...which can be customised as needed. - -## Dependencies - -The repository comes preconfigured to publish its `api` jar back to GitHub's [Gradle Registry][ghGradleReg] as -part of the [CI GitHub workflow][buildYml]. This is handled by the `publish` Gradle task: - -``` -./gradlew publish -``` - -...which can be customised as needed. - -## Environment variables - -### KAFKA_BOOTSTRAP_SERVERS - -The service requires, as a minimum, the `KAFKA_BOOTSTRAP_SERVERS` environment variable set to the location of the Kafka cluster to use. -This maps to the [`bootstrap.servers`][bootstrapServersDocs] Kafka client config. - -**ProTip:** More information about the environment variables supported by the Kafka Streams extension in the -[extension's documentation][kafkaExtEnvVars]. -{: .notice--info} - -[ghGradleReg]: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry -[dockerPlugin]: https://plugins.gradle.org/plugin/com.bmuschko.docker-remote-api -[releasePlugin]: https://plugins.gradle.org/plugin/pl.allegro.tech.build.axion-release -[ghContainers]: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry -[buildYml]: https://github.com/creek-service/aggregate-template/blob/main/.github/workflows/build.yml -[bootstrapServersDocs]: https://kafka.apache.org/documentation/#producerconfigs_bootstrap.servers -[kafkaExtEnvVars]: https://github.com/creek-service/creek-kafka/tree/main/streams-extension#system-environment-variables -[containerReg]: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry -[demoGh]: https://github.com/creek-service/basic-kafka-streams-demo -[handle-occurrence-service-image]: https://github.com/creek-service/basic-kafka-streams-demo/pkgs/container/basic-kafka-streams-demo-handle-occurrence-service -[aggTempVersioning]: https://www.creekservice.org/aggregate-template/features/versioning -[dockerPackage]: https://github.com/creek-service/basic-kafka-streams-demo/pkgs/container/basic-kafka-streams-demo-handle-occurrence-service -[todo]: update links above once documentation migrates \ No newline at end of file diff --git a/docs/_demo/11-further-reading.md_ b/docs/_demo/11-further-reading.md_ deleted file mode 100644 index 0971919..0000000 --- a/docs/_demo/11-further-reading.md_ +++ /dev/null @@ -1,7 +0,0 @@ - -[todo]: link to additional demos, e.g. - -[todo]: - JSON messages -[todo]: - composing services -[todo]: - defining aggregate api -[todo]: - componsing aggregates diff --git a/docs/_pages/404.md b/docs/_pages/404.md deleted file mode 100644 index 9f183f4..0000000 --- a/docs/_pages/404.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "Page Not Found" -excerpt: "Page not found. Your pixels are in another canvas." -sitemap: false -permalink: /404.html ---- - -Sorry, but the page you were trying to view does not exist. :confused: diff --git a/docs/assets/images/creek-add-breakpoint.png b/docs/assets/images/creek-add-breakpoint.png deleted file mode 100644 index 6aa1b66..0000000 Binary files a/docs/assets/images/creek-add-breakpoint.png and /dev/null differ diff --git a/docs/assets/images/creek-add-service.png b/docs/assets/images/creek-add-service.png deleted file mode 100644 index 22ec6bd..0000000 Binary files a/docs/assets/images/creek-add-service.png and /dev/null differ diff --git a/docs/assets/images/creek-attachme-run-config.png b/docs/assets/images/creek-attachme-run-config.png deleted file mode 100644 index 036ce37..0000000 Binary files a/docs/assets/images/creek-attachme-run-config.png and /dev/null differ diff --git a/docs/assets/images/creek-breakpoint-hit.png b/docs/assets/images/creek-breakpoint-hit.png deleted file mode 100644 index 84bf928..0000000 Binary files a/docs/assets/images/creek-breakpoint-hit.png and /dev/null differ diff --git a/docs/assets/images/creek-create-attachme-run-config.png b/docs/assets/images/creek-create-attachme-run-config.png deleted file mode 100644 index 299cc2b..0000000 Binary files a/docs/assets/images/creek-create-attachme-run-config.png and /dev/null differ diff --git a/docs/assets/images/creek-create-new-from-agg-template.png b/docs/assets/images/creek-create-new-from-agg-template.png deleted file mode 100644 index 0e4f025..0000000 Binary files a/docs/assets/images/creek-create-new-from-agg-template.png and /dev/null differ diff --git a/docs/assets/images/creek-demo-design.svg b/docs/assets/images/creek-demo-design.svg deleted file mode 100644 index f9f389e..0000000 --- a/docs/assets/images/creek-demo-design.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/docs/assets/images/creek-repo-bootstrap.png b/docs/assets/images/creek-repo-bootstrap.png deleted file mode 100644 index b77b361..0000000 Binary files a/docs/assets/images/creek-repo-bootstrap.png and /dev/null differ diff --git a/docs/assets/images/creek-system-test-coverage.png b/docs/assets/images/creek-system-test-coverage.png deleted file mode 100644 index 09e96e7..0000000 Binary files a/docs/assets/images/creek-system-test-coverage.png and /dev/null differ diff --git a/docs/assets/images/creek-unit-test-coverage.png b/docs/assets/images/creek-unit-test-coverage.png deleted file mode 100644 index 09e96e7..0000000 Binary files a/docs/assets/images/creek-unit-test-coverage.png and /dev/null differ diff --git a/handle-occurrence-service/Dockerfile b/handle-occurrence-service/Dockerfile index 2b06173..f67ce26 100644 --- a/handle-occurrence-service/Dockerfile +++ b/handle-occurrence-service/Dockerfile @@ -3,7 +3,7 @@ ARG APP_NAME ARG APP_VERSION ENV VERSION=$APP_VERSION -LABEL org.opencontainers.image.source=https://github.com/creek-service/basic-kafka-streams-demo/tree/main/handle-occurrence-service +LABEL org.opencontainers.image.source=https://github.com/creek-service/connected-services-demo/tree/main/handle-occurrence-service RUN yum update -y RUN yum install -y tar lsof diff --git a/handle-occurrence-service/build.gradle.kts b/handle-occurrence-service/build.gradle.kts index 4881321..7414008 100644 --- a/handle-occurrence-service/build.gradle.kts +++ b/handle-occurrence-service/build.gradle.kts @@ -24,8 +24,8 @@ dependencies { modularity.patchModule("kafka.streams", "kafka-streams-test-utils-$kafkaVersion.jar") application { - mainModule.set("basic.kafka.streams.demo.service") - mainClass.set("io.github.creek.service.basic.kafka.streams.demo.service.ServiceMain") + mainModule.set("connected.services.demo.service") + mainClass.set("io.github.creek.service.connected.services.demo.service.ServiceMain") } val buildAppImage = tasks.register("buildAppImage") { diff --git a/handle-occurrence-service/include/bin/run.sh b/handle-occurrence-service/include/bin/run.sh index feb7c7a..eb60c9e 100755 --- a/handle-occurrence-service/include/bin/run.sh +++ b/handle-occurrence-service/include/bin/run.sh @@ -20,4 +20,4 @@ exec java \ -Xms64m -Xmx256m \ -Dlog4j.configurationFile=/log/log4j2.xml \ --module-path "/opt/creek/service/lib" \ - --module basic.kafka.streams.demo.service/io.github.creek.service.basic.kafka.streams.demo.service.ServiceMain + --module connected.services.demo.service/io.github.creek.service.connected.services.demo.service.ServiceMain diff --git a/handle-occurrence-service/src/main/java/io/github/creek/service/basic/kafka/streams/demo/service/ServiceMain.java b/handle-occurrence-service/src/main/java/io/github/creek/service/connected/services/demo/service/ServiceMain.java similarity index 86% rename from handle-occurrence-service/src/main/java/io/github/creek/service/basic/kafka/streams/demo/service/ServiceMain.java rename to handle-occurrence-service/src/main/java/io/github/creek/service/connected/services/demo/service/ServiceMain.java index 221791d..83f4c81 100644 --- a/handle-occurrence-service/src/main/java/io/github/creek/service/basic/kafka/streams/demo/service/ServiceMain.java +++ b/handle-occurrence-service/src/main/java/io/github/creek/service/connected/services/demo/service/ServiceMain.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.github.creek.service.basic.kafka.streams.demo.service; +package io.github.creek.service.connected.services.demo.service; -import io.github.creek.service.basic.kafka.streams.demo.service.kafka.streams.TopologyBuilder; -import io.github.creek.service.basic.kafka.streams.demo.services.HandleOccurrenceServiceDescriptor; +import io.github.creek.service.connected.services.demo.service.kafka.streams.TopologyBuilder; +import io.github.creek.service.connected.services.demo.services.HandleOccurrenceServiceDescriptor; import org.apache.kafka.streams.Topology; import org.creekservice.api.kafka.streams.extension.KafkaStreamsExtension; import org.creekservice.api.kafka.streams.extension.KafkaStreamsExtensionOptions; diff --git a/handle-occurrence-service/src/main/java/io/github/creek/service/basic/kafka/streams/demo/service/kafka/streams/TopologyBuilder.java b/handle-occurrence-service/src/main/java/io/github/creek/service/connected/services/demo/service/kafka/streams/TopologyBuilder.java similarity index 91% rename from handle-occurrence-service/src/main/java/io/github/creek/service/basic/kafka/streams/demo/service/kafka/streams/TopologyBuilder.java rename to handle-occurrence-service/src/main/java/io/github/creek/service/connected/services/demo/service/kafka/streams/TopologyBuilder.java index 0884f7b..1fa2436 100644 --- a/handle-occurrence-service/src/main/java/io/github/creek/service/basic/kafka/streams/demo/service/kafka/streams/TopologyBuilder.java +++ b/handle-occurrence-service/src/main/java/io/github/creek/service/connected/services/demo/service/kafka/streams/TopologyBuilder.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.github.creek.service.basic.kafka.streams.demo.service.kafka.streams; +package io.github.creek.service.connected.services.demo.service.kafka.streams; -import static io.github.creek.service.basic.kafka.streams.demo.services.HandleOccurrenceServiceDescriptor.TweetHandleUsageTopic; -import static io.github.creek.service.basic.kafka.streams.demo.services.HandleOccurrenceServiceDescriptor.TweetTextTopic; +import static io.github.creek.service.connected.services.demo.services.HandleOccurrenceServiceDescriptor.TweetHandleUsageTopic; +import static io.github.creek.service.connected.services.demo.services.HandleOccurrenceServiceDescriptor.TweetTextTopic; import static java.util.Objects.requireNonNull; import static org.creekservice.api.kafka.metadata.KafkaTopicDescriptor.DEFAULT_CLUSTER_NAME; diff --git a/handle-occurrence-service/src/main/java/module-info.java b/handle-occurrence-service/src/main/java/module-info.java index b304cd2..84a945d 100644 --- a/handle-occurrence-service/src/main/java/module-info.java +++ b/handle-occurrence-service/src/main/java/module-info.java @@ -1,5 +1,5 @@ -module basic.kafka.streams.demo.service { - requires basic.kafka.streams.demo.services; +module connected.services.demo.service { + requires connected.services.demo.services; requires creek.service.context; requires creek.kafka.streams.extension; requires org.apache.logging.log4j; diff --git a/handle-occurrence-service/src/test/java/io/github/creek/service/basic/kafka/streams/demo/service/kafka/streams/TopologyBuilderTest.java b/handle-occurrence-service/src/test/java/io/github/creek/service/connected/services/demo/service/kafka/streams/TopologyBuilderTest.java similarity index 92% rename from handle-occurrence-service/src/test/java/io/github/creek/service/basic/kafka/streams/demo/service/kafka/streams/TopologyBuilderTest.java rename to handle-occurrence-service/src/test/java/io/github/creek/service/connected/services/demo/service/kafka/streams/TopologyBuilderTest.java index d8984a8..ba62cd9 100644 --- a/handle-occurrence-service/src/test/java/io/github/creek/service/basic/kafka/streams/demo/service/kafka/streams/TopologyBuilderTest.java +++ b/handle-occurrence-service/src/test/java/io/github/creek/service/connected/services/demo/service/kafka/streams/TopologyBuilderTest.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.github.creek.service.basic.kafka.streams.demo.service.kafka.streams; +package io.github.creek.service.connected.services.demo.service.kafka.streams; // formatting:off -import static io.github.creek.service.basic.kafka.streams.demo.services.HandleOccurrenceServiceDescriptor.TweetTextTopic; -import static io.github.creek.service.basic.kafka.streams.demo.services.HandleOccurrenceServiceDescriptor.TweetHandleUsageTopic; +import static io.github.creek.service.connected.services.demo.services.HandleOccurrenceServiceDescriptor.TweetTextTopic; +import static io.github.creek.service.connected.services.demo.services.HandleOccurrenceServiceDescriptor.TweetHandleUsageTopic; import static org.creekservice.api.kafka.metadata.KafkaTopicDescriptor.DEFAULT_CLUSTER_NAME; import static org.creekservice.api.kafka.streams.test.TestTopics.inputTopic; import static org.creekservice.api.kafka.streams.test.TestTopics.outputTopic; @@ -31,7 +31,7 @@ import org.apache.kafka.streams.TestInputTopic; import org.apache.kafka.streams.TestOutputTopic; // end-snippet -import io.github.creek.service.basic.kafka.streams.demo.services.HandleOccurrenceServiceDescriptor; +import io.github.creek.service.connected.services.demo.services.HandleOccurrenceServiceDescriptor; import org.apache.kafka.streams.Topology; import org.apache.kafka.streams.TopologyTestDriver; import org.creekservice.api.kafka.streams.extension.KafkaStreamsExtension; diff --git a/handle-occurrence-service/src/test/java/module-info.test b/handle-occurrence-service/src/test/java/module-info.test index 4693d13..90c09ca 100644 --- a/handle-occurrence-service/src/test/java/module-info.test +++ b/handle-occurrence-service/src/test/java/module-info.test @@ -2,7 +2,7 @@ org.junitpioneer,org.hamcrest,guava.testlib,creek.test.util,creek.test.hamcrest,creek.kafka.streams.test --add-reads - basic.kafka.streams.demo.service=org.junitpioneer,org.hamcrest,guava.testlib,creek.test.util,creek.test.hamcrest,creek.kafka.streams.test + connected.services.demo.service=org.junitpioneer,org.hamcrest,guava.testlib,creek.test.util,creek.test.hamcrest,creek.kafka.streams.test --add-opens org.junitpioneer/org.junitpioneer.jupiter=org.junit.platform.commons \ No newline at end of file diff --git a/services/src/main/java/io/github/creek/service/basic/kafka/streams/demo/services/HandleOccurrenceServiceDescriptor.java b/services/src/main/java/io/github/creek/service/connected/services/demo/services/HandleOccurrenceServiceDescriptor.java similarity index 88% rename from services/src/main/java/io/github/creek/service/basic/kafka/streams/demo/services/HandleOccurrenceServiceDescriptor.java rename to services/src/main/java/io/github/creek/service/connected/services/demo/services/HandleOccurrenceServiceDescriptor.java index 0e23d3b..ad20000 100644 --- a/services/src/main/java/io/github/creek/service/basic/kafka/streams/demo/services/HandleOccurrenceServiceDescriptor.java +++ b/services/src/main/java/io/github/creek/service/connected/services/demo/services/HandleOccurrenceServiceDescriptor.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package io.github.creek.service.basic.kafka.streams.demo.services; +package io.github.creek.service.connected.services.demo.services; // formatting:off // begin-snippet: includes-1 -import static io.github.creek.service.basic.kafka.streams.demo.internal.TopicConfigBuilder.withPartitions; -import static io.github.creek.service.basic.kafka.streams.demo.internal.TopicDescriptors.inputTopic; -import static io.github.creek.service.basic.kafka.streams.demo.internal.TopicDescriptors.outputTopic; +import static io.github.creek.service.connected.services.demo.internal.TopicConfigBuilder.withPartitions; +import static io.github.creek.service.connected.services.demo.internal.TopicDescriptors.inputTopic; +import static io.github.creek.service.connected.services.demo.internal.TopicDescriptors.outputTopic; // end-snippet import java.util.ArrayList; import java.util.Collection; @@ -67,7 +67,7 @@ public HandleOccurrenceServiceDescriptor() {} @Override public String dockerImage() { - return "ghcr.io/creek-service/basic-kafka-streams-demo-handle-occurrence-service"; + return "ghcr.io/creek-service/connected-services-demo-handle-occurrence-service"; } @Override diff --git a/services/src/main/java/module-info.java b/services/src/main/java/module-info.java index 8a63766..d334cf8 100644 --- a/services/src/main/java/module-info.java +++ b/services/src/main/java/module-info.java @@ -1,10 +1,10 @@ -import io.github.creek.service.basic.kafka.streams.demo.services.HandleOccurrenceServiceDescriptor; +import io.github.creek.service.connected.services.demo.services.HandleOccurrenceServiceDescriptor; import org.creekservice.api.platform.metadata.ComponentDescriptor; -module basic.kafka.streams.demo.services { - requires transitive basic.kafka.streams.demo.api; +module connected.services.demo.services { + requires transitive connected.services.demo.api; - exports io.github.creek.service.basic.kafka.streams.demo.services; + exports io.github.creek.service.connected.services.demo.services; provides ComponentDescriptor with HandleOccurrenceServiceDescriptor; diff --git a/services/src/main/resources/META-INF/services/org.creekservice.api.platform.metadata.ComponentDescriptor b/services/src/main/resources/META-INF/services/org.creekservice.api.platform.metadata.ComponentDescriptor index 0567470..6d1e138 100644 --- a/services/src/main/resources/META-INF/services/org.creekservice.api.platform.metadata.ComponentDescriptor +++ b/services/src/main/resources/META-INF/services/org.creekservice.api.platform.metadata.ComponentDescriptor @@ -14,4 +14,4 @@ # limitations under the License. # -io.github.creek.service.basic.kafka.streams.demo.services.HandleOccurrenceServiceDescriptor \ No newline at end of file +io.github.creek.service.connected.services.demo.services.HandleOccurrenceServiceDescriptor \ No newline at end of file diff --git a/services/src/test/java/io/github/creek/service/basic/kafka/streams/demo/services/HandleOccurrenceServiceDescriptorTest.java b/services/src/test/java/io/github/creek/service/connected/services/demo/services/HandleOccurrenceServiceDescriptorTest.java similarity index 94% rename from services/src/test/java/io/github/creek/service/basic/kafka/streams/demo/services/HandleOccurrenceServiceDescriptorTest.java rename to services/src/test/java/io/github/creek/service/connected/services/demo/services/HandleOccurrenceServiceDescriptorTest.java index 75b2fab..aac0e94 100644 --- a/services/src/test/java/io/github/creek/service/basic/kafka/streams/demo/services/HandleOccurrenceServiceDescriptorTest.java +++ b/services/src/test/java/io/github/creek/service/connected/services/demo/services/HandleOccurrenceServiceDescriptorTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.github.creek.service.basic.kafka.streams.demo.services; +package io.github.creek.service.connected.services.demo.services; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.hasItem; diff --git a/services/src/test/java/module-info.test b/services/src/test/java/module-info.test index 260604b..e7d7a7f 100644 --- a/services/src/test/java/module-info.test +++ b/services/src/test/java/module-info.test @@ -2,7 +2,7 @@ org.junitpioneer,org.hamcrest,guava.testlib,creek.test.util,creek.test.hamcrest --add-reads - basic.kafka.streams.demo.services=org.junitpioneer,org.hamcrest,guava.testlib,creek.test.util,creek.test.hamcrest + connected.services.demo.services=org.junitpioneer,org.hamcrest,guava.testlib,creek.test.util,creek.test.hamcrest --add-opens org.junitpioneer/org.junitpioneer.jupiter=org.junit.platform.commons \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 659cf18..21c5a2c 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,4 +1,4 @@ -rootProject.name = "basic-kafka-streams-demo" +rootProject.name = "connected-services-demo" include( "api",