MCPcopy Create free account
hub / github.com/apache/kafka / Producer

Method Producer

examples/src/main/java/kafka/examples/Producer.java:30–38  ·  view source on GitHub ↗
(String topic)

Source from the content-addressed store, hash-verified

28 private final Properties props = new Properties();
29
30 public Producer(String topic)
31 {
32 props.put("serializer.class", "kafka.serializer.StringEncoder");
33 props.put("metadata.broker.list", "localhost:9092");
34 // Use random partitioner. Don't need the key type. Just set it to Integer.
35 // The message is of type String.
36 producer = new kafka.javaapi.producer.Producer<Integer, String>(new ProducerConfig(props));
37 this.topic = topic;
38 }
39
40 public void run() {
41 int messageNo = 1;

Callers

nothing calls this directly

Calls 1

putMethod · 0.45

Tested by

no test coverage detected