Class SinkMapper

  • Direct Known Subclasses:
    PassThroughSinkMapper

    public abstract class SinkMapper
    extends Object
    Abstract parent class to represent event mappers. Events mappers will receive Events and can convert them to any desired object type (Ex: XML, JSON). Custom mappers can be implemented as extensions extending this abstract implementation.
    • Field Detail

      • sinkType

        protected String sinkType
    • Constructor Detail

      • SinkMapper

        public SinkMapper()
    • Method Detail

      • buildMapperTemplate

        protected void buildMapperTemplate​(io.siddhi.query.api.definition.StreamDefinition streamDefinition,
                                           List<io.siddhi.query.api.annotation.Element> unmappedPayloadList)
        Method to create mapper template.
        Parameters:
        streamDefinition - Stream definition corresponding to mapper
        unmappedPayloadList - mapper payload template list
      • getSupportedDynamicOptions

        public abstract String[] getSupportedDynamicOptions()
        Supported dynamic options by the mapper
        Returns:
        the list of supported dynamic option keys
      • init

        public abstract void init​(io.siddhi.query.api.definition.StreamDefinition streamDefinition,
                                  OptionHolder optionHolder,
                                  Map<String,​TemplateBuilder> payloadTemplateBuilderMap,
                                  ConfigReader mapperConfigReader,
                                  SiddhiAppContext siddhiAppContext)
        Initialize the mapper and the mapping configurations.
        Parameters:
        streamDefinition - The stream definition
        optionHolder - Option holder containing static and dynamic options related to the mapper
        payloadTemplateBuilderMap - Un mapped payloads for reference
        mapperConfigReader - System configuration reader for Sink-mapper.
        siddhiAppContext - Siddhi Application Context
      • getOutputEventClasses

        public abstract Class[] getOutputEventClasses()
        Get produced event class types
        Returns:
        Array of classes that will be produced by the sink-mapper, null or empty array if it can produce any type of class.
      • mapAndSend

        public abstract void mapAndSend​(Event[] events,
                                        OptionHolder optionHolder,
                                        Map<String,​TemplateBuilder> payloadTemplateBuilderMap,
                                        SinkListener sinkListener)
        Called to map the events and send them to SinkListener for publishing
        Parameters:
        events - Events that need to be mapped
        optionHolder - Option holder containing static and dynamic options related to the mapper
        payloadTemplateBuilderMap - To build the message payloads based on the given templates
        sinkListener - SinkListener that will be called with the mapped events
      • mapAndSend

        public abstract void mapAndSend​(Event event,
                                        OptionHolder optionHolder,
                                        Map<String,​TemplateBuilder> payloadTemplateBuilderMap,
                                        SinkListener sinkListener)
        Called to map the event and send it to SinkListener for publishing
        Parameters:
        event - Event that need to be mapped
        optionHolder - Option holder containing static and dynamic options related to the mapper
        payloadTemplateBuilderMap - To build the message payloads based on the given templates
        sinkListener - SinkListener that will be called with the mapped event
      • getType

        public final String getType()