kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jun...@apache.org
Subject kafka git commit: kafka-2109; Support retries in KafkaLog4jAppender; patched by Dave Beech; reviewed by Jun Rao
Date Wed, 08 Apr 2015 21:33:51 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk b47f811ee -> d3aa99c54


kafka-2109; Support retries in KafkaLog4jAppender; patched by Dave Beech; reviewed by Jun
Rao


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/d3aa99c5
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/d3aa99c5
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/d3aa99c5

Branch: refs/heads/trunk
Commit: d3aa99c54a41d45d42c8fd19b98747b4190d8433
Parents: b47f811
Author: Dave Beech <dbeech@apache.org>
Authored: Wed Apr 8 14:33:47 2015 -0700
Committer: Jun Rao <junrao@gmail.com>
Committed: Wed Apr 8 14:33:47 2015 -0700

----------------------------------------------------------------------
 core/src/main/scala/kafka/producer/KafkaLog4jAppender.scala | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/d3aa99c5/core/src/main/scala/kafka/producer/KafkaLog4jAppender.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/producer/KafkaLog4jAppender.scala b/core/src/main/scala/kafka/producer/KafkaLog4jAppender.scala
index 652dfb8..5d36a01 100644
--- a/core/src/main/scala/kafka/producer/KafkaLog4jAppender.scala
+++ b/core/src/main/scala/kafka/producer/KafkaLog4jAppender.scala
@@ -29,6 +29,7 @@ class KafkaLog4jAppender extends AppenderSkeleton with Logging {
   var topic: String = null
   var brokerList: String = null
   var compressionType: String = null
+  var retries: Int = 0
   var requiredNumAcks: Int = Int.MaxValue
   var syncSend: Boolean = false
 
@@ -49,6 +50,9 @@ class KafkaLog4jAppender extends AppenderSkeleton with Logging {
   def getSyncSend: Boolean = syncSend
   def setSyncSend(syncSend: Boolean) { this.syncSend = syncSend }
 
+  def getRetries: Int = retries
+  def setRetries(retries: Int) { this.retries = retries }
+
   override def activateOptions() {
     // check for config parameter validity
     val props = new Properties()
@@ -60,6 +64,7 @@ class KafkaLog4jAppender extends AppenderSkeleton with Logging {
       throw new MissingConfigException("topic must be specified by the Kafka log4j appender")
     if(compressionType != null) props.put(org.apache.kafka.clients.producer.ProducerConfig.COMPRESSION_TYPE_CONFIG,
compressionType)
     if(requiredNumAcks != Int.MaxValue) props.put(org.apache.kafka.clients.producer.ProducerConfig.ACKS_CONFIG,
requiredNumAcks.toString)
+    if(retries > 0) props.put(org.apache.kafka.clients.producer.ProducerConfig.RETRIES_CONFIG,
retries.toString)
     props.put(org.apache.kafka.clients.producer.ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG,
"org.apache.kafka.common.serialization.ByteArraySerializer")
     props.put(org.apache.kafka.clients.producer.ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
"org.apache.kafka.common.serialization.ByteArraySerializer")
     producer = new KafkaProducer[Array[Byte],Array[Byte]](props)


Mime
View raw message