Last active
October 16, 2018 17:15
-
-
Save adekunleba/5063b311aeb0209b0bbfa4057d99e2a5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.apache.kafka.clients.consumer.ConsumerConfig | |
| import org.apache.kafka.common.serialization.StringDeserializer | |
| object KafkaSupport { | |
| def getKafkaConsumerConfig(brokers: String, groupID: String): Map[String, String] = { | |
| Map[String, String]( | |
| ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG -> brokers, | |
| ConsumerConfig.GROUP_ID_CONFIG -> groupID, | |
| ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG -> "true", | |
| ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG -> "1000", | |
| ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG -> "30000", | |
| ConsumerConfig.MAX_POLL_RECORDS_CONFIG -> "10", | |
| ConsumerConfig.AUTO_OFFSET_RESET_CONFIG -> "earliest", | |
| ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG -> classOf[StringDeserializer].getTypeName, | |
| ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG -> classOf[StringDeserializer].getTypeName) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment