Search in sources :

Example 1 with TemplateBuilder

use of org.ballerinalang.siddhi.core.util.transport.TemplateBuilder in project ballerina by ballerina-lang.

the class SinkMapper method init.

public final void init(StreamDefinition streamDefinition, String type, OptionHolder mapOptionHolder, List<Element> unmappedPayloadList, Sink sink, ConfigReader mapperConfigReader, LatencyTracker mapperLatencyTracker, SiddhiAppContext siddhiAppContext) {
    this.mapperLatencyTracker = mapperLatencyTracker;
    this.siddhiAppContext = siddhiAppContext;
    sink.setTrpDynamicOptions(trpDynamicOptions);
    this.sinkListener = sink;
    this.optionHolder = mapOptionHolder;
    this.type = type;
    if (unmappedPayloadList != null && !unmappedPayloadList.isEmpty()) {
        templateBuilderMap = new HashMap<>();
        for (Element e : unmappedPayloadList) {
            TemplateBuilder templateBuilder = new TemplateBuilder(streamDefinition, e.getValue());
            if (templateBuilderMap.containsKey(e.getKey())) {
                throw new SiddhiAppCreationException("Duplicate Keys, " + e.getKey() + ", in @payload() ");
            }
            templateBuilderMap.put(e.getKey(), templateBuilder);
        }
    }
    init(streamDefinition, mapOptionHolder, templateBuilderMap, mapperConfigReader, siddhiAppContext);
}
Also used : SiddhiAppCreationException(org.ballerinalang.siddhi.core.exception.SiddhiAppCreationException) Element(org.ballerinalang.siddhi.query.api.annotation.Element) TemplateBuilder(org.ballerinalang.siddhi.core.util.transport.TemplateBuilder)

Aggregations

SiddhiAppCreationException (org.ballerinalang.siddhi.core.exception.SiddhiAppCreationException)1 TemplateBuilder (org.ballerinalang.siddhi.core.util.transport.TemplateBuilder)1 Element (org.ballerinalang.siddhi.query.api.annotation.Element)1