public class VerifiableProducer
extends java.lang.Object
Constructor and Description |
---|
VerifiableProducer(java.util.Properties producerProps,
java.lang.String topic,
int throughput,
int maxMessages) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the producer to flush any remaining messages.
|
static VerifiableProducer |
createFromArgs(java.lang.String[] args)
Construct a VerifiableProducer object from command-line arguments.
|
static java.util.Properties |
loadProps(java.lang.String filename)
Read a properties file from the given path
|
static void |
main(java.lang.String[] args) |
void |
send(java.lang.String key,
java.lang.String value)
Produce a message with given key and value.
|
public VerifiableProducer(java.util.Properties producerProps, java.lang.String topic, int throughput, int maxMessages)
public static java.util.Properties loadProps(java.lang.String filename) throws java.io.IOException, java.io.FileNotFoundException
filename
- The path of the file to read
Note: this duplication of org.apache.kafka.common.utils.Utils.loadProps is unfortunate
but *intentional*. In order to use VerifiableProducer in compatibility and upgrade tests,
we use VerifiableProducer from trunk tools package, and run it against 0.8.X.X kafka jars.
Since this method is not in Utils in the 0.8.X.X jars, we have to cheat a bit and duplicate.java.io.IOException
java.io.FileNotFoundException
public static VerifiableProducer createFromArgs(java.lang.String[] args)
public void send(java.lang.String key, java.lang.String value)
public void close()
public static void main(java.lang.String[] args) throws java.io.IOException
java.io.IOException