Skip to content

Commit

Permalink
kafka-1700; examples directory - README and shell scripts are out of …
Browse files Browse the repository at this point in the history
…date; patched by Geoffrey Anderson; reviewed by Jun Rao
  • Loading branch information
granders authored and junrao committed Oct 23, 2014
1 parent 35f589b commit b770996
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 92 deletions.
13 changes: 1 addition & 12 deletions examples/README
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
This directory contains examples of client code that uses kafka.

The default target for ant is kafka.examples.KafkaConsumerProducerDemo which sends and receives
messages from Kafka server.

In order to run demo from SBT:
1. Start Zookeeper and the Kafka server
2. ./sbt from top-level kafka directory
3. Switch to the kafka java examples project -> project kafka-examples
4. execute run -> run
5. For simple consumer demo, select option 1
For unlimited producer-consumer run, select option 2

To run the demo using scripts:
To run the demo:

1. Start Zookeeper and the Kafka server
2. For simple consumer demo, run bin/java-simple-consumer-demo.sh
Expand Down
43 changes: 3 additions & 40 deletions examples/bin/java-producer-consumer-demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,44 +16,7 @@

base_dir=$(dirname $0)/../..

for file in $base_dir/project/boot/scala-2.8.0/lib/*.jar;
do
if [ ${file##*/} != "sbt-launch.jar" ]; then
CLASSPATH=$CLASSPATH:$file
fi
done

for file in $base_dir/core/lib_managed/scala_2.8.0/compile/*.jar;
do
CLASSPATH=$CLASSPATH:$file
done

for file in $base_dir/core/lib/*.jar;
do
CLASSPATH=$CLASSPATH:$file
done

for file in $base_dir/core/target/scala_2.8.0/*.jar;
do
CLASSPATH=$CLASSPATH:$file
done

for file in $base_dir/examples/target/scala_2.8.0/*.jar;
do
CLASSPATH=$CLASSPATH:$file
done

echo $CLASSPATH

if [ -z "$KAFKA_PERF_OPTS" ]; then
KAFKA_OPTS="-Xmx512M -server -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3333 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
fi

if [ -z "$JAVA_HOME" ]; then
JAVA="java"
else
JAVA="$JAVA_HOME/bin/java"
if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then
export KAFKA_HEAP_OPTS="-Xmx512M"
fi

$JAVA $KAFKA_OPTS -cp $CLASSPATH kafka.examples.KafkaConsumerProducerDemo $@

exec $base_dir/bin/kafka-run-class.sh kafka.examples.KafkaConsumerProducerDemo $@
43 changes: 3 additions & 40 deletions examples/bin/java-simple-consumer-demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,44 +16,7 @@

base_dir=$(dirname $0)/../..

for file in $base_dir/project/boot/scala-2.8.0/lib/*.jar;
do
if [ ${file##*/} != "sbt-launch.jar" ]; then
CLASSPATH=$CLASSPATH:$file
fi
done

for file in $base_dir/core/lib_managed/scala_2.8.0/compile/*.jar;
do
CLASSPATH=$CLASSPATH:$file
done

for file in $base_dir/core/lib/*.jar;
do
CLASSPATH=$CLASSPATH:$file
done

for file in $base_dir/core/target/scala_2.8.0/*.jar;
do
CLASSPATH=$CLASSPATH:$file
done

for file in $base_dir/examples/target/scala_2.8.0/*.jar;
do
CLASSPATH=$CLASSPATH:$file
done

echo $CLASSPATH

if [ -z "$KAFKA_PERF_OPTS" ]; then
KAFKA_OPTS="-Xmx512M -server -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3333 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
fi

if [ -z "$JAVA_HOME" ]; then
JAVA="java"
else
JAVA="$JAVA_HOME/bin/java"
if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then
export KAFKA_HEAP_OPTS="-Xmx512M"
fi

$JAVA $KAFKA_OPTS -cp $CLASSPATH kafka.examples.SimpleConsumerDemo $@

exec $base_dir/bin/kafka-run-class.sh kafka.examples.SimpleConsumerDemo $@

0 comments on commit b770996

Please sign in to comment.