Browse Source

Tweak example and docs

Evan Huus 12 years ago
parent
commit
0870a36965
2 changed files with 4 additions and 4 deletions
  1. 3 3
      producer.go
  2. 1 1
      producer_test.go

+ 3 - 3
producer.go

@@ -2,9 +2,9 @@ package sarama
 
 
 // ProducerConfig is used to pass multiple configuration options to NewProducer.
 // ProducerConfig is used to pass multiple configuration options to NewProducer.
 type ProducerConfig struct {
 type ProducerConfig struct {
-	Partitioner  Partitioner  // Chooses the partition to send messages to, or randomly if this is nil
-	RequiredAcks RequiredAcks // The level of acknowledgement reliability needed from the broker
-	Timeout      int32        // The maximum time in ms the broker will wait the receipt of the number of RequiredAcks
+	Partitioner  Partitioner  // Chooses the partition to send messages to, or randomly if this is nil.
+	RequiredAcks RequiredAcks // The level of acknowledgement reliability needed from the broker (defaults to no acknowledgement).
+	Timeout      int32        // The maximum time in ms the broker will wait the receipt of the number of RequiredAcks.
 }
 }
 
 
 // Producer publishes Kafka messages on a given topic. It routes messages to the correct broker, refreshing metadata as appropriate,
 // Producer publishes Kafka messages on a given topic. It routes messages to the correct broker, refreshing metadata as appropriate,

+ 1 - 1
producer_test.go

@@ -71,7 +71,7 @@ func ExampleProducer() {
 	} else {
 	} else {
 		fmt.Println("> connected")
 		fmt.Println("> connected")
 	}
 	}
-	producer, err := NewProducer(client, "myTopic", ProducerConfig{})
+	producer, err := NewProducer(client, "myTopic", ProducerConfig{RequiredAcks: WAIT_FOR_LOCAL})
 	if err != nil {
 	if err != nil {
 		panic(err)
 		panic(err)
 	}
 	}