Example usage for org.apache.solr.client.solrj.io.stream.expr StreamExplanation addChild

List of usage examples for org.apache.solr.client.solrj.io.stream.expr StreamExplanation addChild

Introduction

In this page you can find the example usage for org.apache.solr.client.solrj.io.stream.expr StreamExplanation addChild.

Prototype

public void addChild(Explanation child) 

Source Link

Usage

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

License:Apache License

/**
 * Returns a valid explanation of this stream instance
 *///from  w w  w .  jav a2 s  .  c  om
@Override
public Explanation toExplanation(StreamFactory factory) throws IOException {

    StreamExplanation explanation = new StreamExplanation(getStreamNodeId().toString());
    explanation.setFunctionName(String.format(Locale.ROOT, factory.getFunctionName(getClass())));
    explanation.setImplementingClass(getClass().getName());
    explanation.setExpressionType(ExpressionType.STREAM_SOURCE);

    // child is a kafka topic so add it at this point
    StreamExplanation child = new StreamExplanation(getStreamNodeId() + "-kafka-topic");
    child.setFunctionName(String.format(Locale.ROOT, "kafka (%s)", topic));
    child.setImplementingClass("Kafka");
    child.setExpressionType(ExpressionType.DATASTORE);
    child.setExpression("Consuming from " + bootstrapServers);

    explanation.addChild(child);

    return explanation;
}