Skip to content

Commit

Permalink
Add on start documentation (#85)
Browse files Browse the repository at this point in the history
* Add on start documentation

* Add on start entry

* Replace implements by extends
  • Loading branch information
Loïc GREFFIER authored Sep 6, 2023
1 parent 9daa18a commit 75680fa
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ 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)
* [On Start](#on-start)
* [Testing](#testing)
* [Motivation](#motivation)
* [Contribution](#contribution)
Expand Down Expand Up @@ -252,6 +254,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 extends 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`.
Expand Down

0 comments on commit 75680fa

Please sign in to comment.