mirror of https://github.com/apache/kafka.git
kafka-1700; examples directory - README and shell scripts are out of date; patched by Geoffrey Anderson; reviewed by Jun Rao
This commit is contained in:
parent
35f589bb46
commit
b77099626e
|
@ -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
|
||||
|
|
|
@ -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
|
||||
if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then
|
||||
export KAFKA_HEAP_OPTS="-Xmx512M"
|
||||
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"
|
||||
fi
|
||||
|
||||
$JAVA $KAFKA_OPTS -cp $CLASSPATH kafka.examples.KafkaConsumerProducerDemo $@
|
||||
|
||||
exec $base_dir/bin/kafka-run-class.sh kafka.examples.KafkaConsumerProducerDemo $@
|
||||
|
|
|
@ -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
|
||||
if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then
|
||||
export KAFKA_HEAP_OPTS="-Xmx512M"
|
||||
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"
|
||||
fi
|
||||
|
||||
$JAVA $KAFKA_OPTS -cp $CLASSPATH kafka.examples.SimpleConsumerDemo $@
|
||||
|
||||
exec $base_dir/bin/kafka-run-class.sh kafka.examples.SimpleConsumerDemo $@
|
||||
|
|
Loading…
Reference in New Issue