Example usage for org.apache.solr.client.solrj.io Tuple Tuple

List of usage examples for org.apache.solr.client.solrj.io Tuple Tuple

Introduction

In this page you can find the example usage for org.apache.solr.client.solrj.io Tuple Tuple.

Prototype

public Tuple(Map fields) 

Source Link

Usage

From source file:com.dennisgove.streaming.expressions.kafka.KafkaTopicConsumerStream.java

License:Apache License

private void loadTupleList(long pollTimeout) {
    for (ConsumerRecord<String, String> record : consumerClient.poll(pollTimeout)) {
        try {//from  w w w .  j  a  v  a2 s  .com
            // Here we are assuming the json is representative of the fields
            // part of a tuple. This should be changed if and when we want to
            // handle the passing of full tuples via kafka
            tupleList.add(new Tuple((Map) ObjectBuilder.fromJSON(record.value())));
        } catch (Throwable e) {
            // log that there was an error, but continue going
            log.error(String.format(Locale.ROOT,
                    "Failed to convert kafka record a valid Tuple. Topic '%s', group '%s', and record key '%s' - %s",
                    topic, groupId, record.key(), e.getMessage()), e);
        }
    }
}