From a5f7f425a8a54921155827842d4520f2f73e0ab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20GREFFIER?= Date: Mon, 18 Sep 2023 12:30:37 +0200 Subject: [PATCH] Add documentation for interactive queries (#91) * Add documentation for interactive queries * Update interactive queries documentation --- README.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/README.md b/README.md index a1976907..cb13525b 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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`.