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

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

Introduction

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

Prototype

public void put(Object key, Object value) 

Source Link

Usage

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

License:Apache License

/**
 * Returns the next record off the topic in Tuple form. Will wait until at least one record is read from
 * from the topic, or the stream is closed.
 *///  w  w  w .j  a  v  a 2s  .  co  m
@Override
public Tuple read() throws IOException {

    // Get next set of available records, keep repeating until we get something
    while (tupleList.isEmpty()) {

        // if we're closed then return EOF
        if (!isOpen.get()) {
            Tuple eof = new Tuple();
            eof.EOF = true;
            return eof;
        }

        // wait at most 1s
        loadTupleList(1000);
    }

    // At this point we will absolutely have a tuple.
    Tuple tuple = tupleList.pop();
    if (tuple.EOF) {
        tuple.put("__kafkaRecordCount__", recordsRead);
    } else {
        recordsRead += 1;
    }

    return tuple;
}