Search in sources :

Example 31 with SiddhiAppCreationException

use of org.wso2.siddhi.core.exception.SiddhiAppCreationException in project siddhi by wso2.

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.wso2.siddhi.core.exception.SiddhiAppCreationException) Element(org.wso2.siddhi.query.api.annotation.Element) TemplateBuilder(org.wso2.siddhi.core.util.transport.TemplateBuilder)

Aggregations

SiddhiAppCreationException (org.wso2.siddhi.core.exception.SiddhiAppCreationException)30 Attribute (org.wso2.siddhi.query.api.definition.Attribute)14 Expression (org.wso2.siddhi.query.api.expression.Expression)10 VariableExpressionExecutor (org.wso2.siddhi.core.executor.VariableExpressionExecutor)9 MetaStreamEvent (org.wso2.siddhi.core.event.stream.MetaStreamEvent)8 ExpressionExecutor (org.wso2.siddhi.core.executor.ExpressionExecutor)8 Element (org.wso2.siddhi.query.api.annotation.Element)7 ArrayList (java.util.ArrayList)6 AbstractDefinition (org.wso2.siddhi.query.api.definition.AbstractDefinition)6 Variable (org.wso2.siddhi.query.api.expression.Variable)6 HashMap (java.util.HashMap)5 ConfigReader (org.wso2.siddhi.core.util.config.ConfigReader)5 Annotation (org.wso2.siddhi.query.api.annotation.Annotation)5 ReturnAttribute (org.wso2.siddhi.annotation.ReturnAttribute)4 MetaStateEvent (org.wso2.siddhi.core.event.state.MetaStateEvent)4 Table (org.wso2.siddhi.core.table.Table)4 CompiledCondition (org.wso2.siddhi.core.util.collection.operator.CompiledCondition)4 MatchingMetaInfoHolder (org.wso2.siddhi.core.util.collection.operator.MatchingMetaInfoHolder)4 SiddhiAppValidationException (org.wso2.siddhi.query.api.exception.SiddhiAppValidationException)4 AttributeFunction (org.wso2.siddhi.query.api.expression.AttributeFunction)4