Running a Kafka Streams Java App

Describes how to set up and run a Kafka Streams Java application.

Setup

To set up your project, add the required dependencies to the pom.xml file, as shown in the example. Note that the versions you use may differ from the versions shown in the example. Version numbers typically change with new releases.

Maven artifacts are published to https://repository.mapr.com/maven/. You can also refer to Maven Artifacts for the HPE Ezmeral Data Fabric for dependency versions.

Example pom.xml

The following example shows the dependencies you must add to pom.xml.
<repository>
    <id>mapr-releases</id>
    <url>https://repository.mapr.com/maven/</url>
</repository>

...
<dependency>
    <groupId>org.apache.kafka</groupId>
    <artifactId>kafka-streams</artifactId>
    <version>3.6.1.0-eep-930</version>
</dependency>

Running a Kafka Streams App on a Cluster

To run a Kafka Streams Java application on a cluster:

  1. Copy the <Kafka Streams Java application>.jar file to an arbitrary folder on your cluster.
  2. Run the following shell command on your cluster:
    java -cp "$(mapr clientclasspath):<path to Kafka Streams application jar>" <Kafka Streams application main class>