خرید بک لینک

Vote count: 0

When Kafka Consumer is launched from terminal, it is possible to set --from-begiing, so that the consumer read messages from the begiing of a Kafka queue.

~/kafka/bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic TutorialTopic --from-begiing

However, how can I set this parameter in Scala (or Java)? This is my sample ConsumerConfig:

  def createConsumerConfig(zookeeper: String, groupId: String): ConsumerConfig = {
    val props = new Properties()
    props.put("zookeeper.coect", zookeeper);
    props.put("group.id", groupId);
    props.put("auto.offset.reset", "largest");
    props.put("zookeeper.session.timeout.ms", "400");
    props.put("zookeeper.sync.time.ms", "200");
    props.put("auto.commit.interval.ms", "1000");
    val config = new ConsumerConfig(props)
    config
  }

asked 30 secs ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 19 تير 1395 ساعت: 19:08

صفحه بندی