Compiling and Launching MapR Streams Java Producers and Consumers

You can compile producers and consumers by using the required JAR file from the MapR Maven repository or from the MapR installation. Launch producers and consumers with the mapr command.

Using the JAR File from the MapR Maven Repository
Note: This method works only if your MapR cluster is not secure.
  1. Add MapR's Maven repository to your pom.xml file, if it is not already added:
        <repositories>
        <repository>
          <id>mapr-releases</id>
          <url>http://repository.mapr.com/nexus/content/repositories/releases</url>
          <snapshots><enabled>true</enabled></snapshots>
          <releases><enabled>true</enabled></releases>
        </repository>
      </repositories>
  2. Add a dependency to the kafka-clients project:
        <dependency>
          <groupId>org.apache.kafka</groupId>
          <artifactId>kafka-clients</artifactId>
          <version>0.9.0.0-mapr-1607-streams-5.2.0</version>
        </dependency>
Using JARs from the MapR Installation
Use the following command to compile applications:
javac -cp `mapr classpath` <Application jars>

Launching Applications

Use the following command to launch applications:
mapr <Main class jar> <commandline arguments>
Note: If you want to add JAR files to the classpath that the mapr command uses, add them with the environment variable MAPR_CLASSPATH.

Example:

export MAPR_CLASSPATH=/home/apps/awesome-1.0.jar
mapr com.company.MyAwesomeApp