Skip to content

Commit

Permalink
Add documentation for interactive queries (#91)
Browse files Browse the repository at this point in the history
* Add documentation for interactive queries

* Update interactive queries documentation
  • Loading branch information
Loïc GREFFIER authored Sep 18, 2023
1 parent 7f47d45 commit a5f7f42
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Kstreamplify is a Java library that brings new features on top of Kafka Streams.
* [REST Endpoints](#rest-endpoints)
* [Hooks](#hooks)
* [On Start](#on-start)
* [Interactive Queries](#interactive-queries)
* [Testing](#testing)
* [Motivation](#motivation)
* [Contribution](#contribution)
Expand Down Expand Up @@ -274,6 +275,41 @@ public class MyKafkaStreams extends KafkaStreamsStarter {

You can use this hook to perform any custom initialization or setup tasks for your Kafka Streams application.

### Interactive Queries

Kstreamplify is designed to make your Kafka Streams instance ready for [interactive queries](https://docs.confluent.io/platform/current/streams/developer-guide/interactive-queries.html), including support for RPC (Remote Procedure Call).

The `application.server` property, which should contain the host:port information, is automatically handled by Kstreamplify.
The property can be loaded in three different ways.
By order of priority:

- an environment variable whose name is defined by the `ip.env.var.name` property.

```yml
kafka:
properties:
ip.env.var.name: MY_APPLICATION_PORT_HOST
```

Where `MY_APPLICATION_PORT_HOST` contains the host:port information.

- an environment variable named `MY_POD_IP`. This is particularly useful when loading host:port information from Kubernetes.

Here's an extract of a Kubernetes deployment which set the `MY_POD_IP` environment variable in a Kubernetes environment:

```yml
...
containers:
env:
- name: MY_POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
...
```

- If neither the variable environment nor the `MY_POD_IP` environment variable is set, Kstreamplify sets `application.server` to the default value `localhost`.

### 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 a5f7f42

Please sign in to comment.