if (this.earliestOffset == -2 && uri != null) {
// TODO : Make the hardcoded paramters configurable
SimpleConsumer consumer = new SimpleConsumer(uri.getHost(), uri.getPort(), 60000,
1024 * 1024, "hadoop-etl");
Map<TopicAndPartition, PartitionOffsetRequestInfo> offsetInfo = new HashMap<TopicAndPartition, PartitionOffsetRequestInfo>();
offsetInfo.put(new TopicAndPartition(topic, partition), new PartitionOffsetRequestInfo(
kafka.api.OffsetRequest.EarliestTime(), 1));
OffsetResponse response = consumer
.getOffsetsBefore(new OffsetRequest(offsetInfo, kafka.api.OffsetRequest
.CurrentVersion(), "hadoop-etl"));
long[] endOffset = response.offsets(topic, partition);