Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add on start documentation #85

Merged
merged 3 commits into from
Sep 6, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 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`.
Expand Down