From fefdcf98e0d6708a006ba664e6a55aa3b72b9787 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Greffier?= Date: Wed, 6 Sep 2023 11:09:51 +0200 Subject: [PATCH 1/3] Add on start documentation --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index eb5a2b20..fc301798 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ Kstreamplify is a Java library that brings new features on top of Kafka Streams. * [Production and Deserialization](#production-and-deserialization) * [Avro Schema](#avro-schema) * [REST Endpoints](#rest-endpoints) + * [Hooks](#hooks) * [Testing](#testing) * [Motivation](#motivation) * [Contribution](#contribution) @@ -252,6 +253,26 @@ The Kstreamplify library provides several REST endpoints, which are listed below - `GET /liveness`: This endpoint is used as a liveness probe for Kubernetes deployment. - `GET /topology`: This endpoint returns the Kafka Streams topology as JSON. +### Hooks + +Kstreamplify offers the flexibility to execute custom code through hooks. These hooks can be defined by overriding specific methods. + +#### On Start + +The `On Start` hook allows you to execute code right after the Kafka Streams instantiation. It provides the Kafka Streams instance as a parameter. + +```java +@Component +public class MyKafkaStreams implements KafkaStreamsStarter { + @Override + public void onStart(KafkaStreams kafkaStreams) { + // Your code here + } +} +``` + +You can use this hook to perform any custom initialization or setup tasks for your Kafka Streams application. + ### Testing For testing, you can create a test class that implements `KafkaStreamsStarterTest` and override the `topology` method. Then, apply the topology of your Kafka Streams on the given `streamsBuilders`. From 513fed834e65a1694e9b18ab2f8fafbcc89082a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Greffier?= Date: Wed, 6 Sep 2023 11:13:32 +0200 Subject: [PATCH 2/3] Add on start entry --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index fc301798..619c1670 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ Kstreamplify is a Java library that brings new features on top of Kafka Streams. * [Avro Schema](#avro-schema) * [REST Endpoints](#rest-endpoints) * [Hooks](#hooks) + * [On Start](#on-start) * [Testing](#testing) * [Motivation](#motivation) * [Contribution](#contribution) From 523766226736a0e4514396fccc53462323bce73f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Greffier?= Date: Wed, 6 Sep 2023 11:32:25 +0200 Subject: [PATCH 3/3] Replace implements by extends --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 619c1670..d9c7f3a3 100644 --- a/README.md +++ b/README.md @@ -264,7 +264,7 @@ The `On Start` hook allows you to execute code right after the Kafka Streams ins ```java @Component -public class MyKafkaStreams implements KafkaStreamsStarter { +public class MyKafkaStreams extends KafkaStreamsStarter { @Override public void onStart(KafkaStreams kafkaStreams) { // Your code here