com.ibm.streamsx.topology.spi.builder

Interface Invoker



  • public interface Invoker
    This is part of the SPI to allow additional functional style functionality to built using the primitives provided by this toolkit. The config object contains information about the invocation of an operator. If executing in embedded then the JSON graph must be provided with the mapping of Java primitive kind to Java class in Properties.Graph.Config.JAVA_OPS.
    • Method Summary

      All Methods Static Methods Default Methods 
      Modifier and Type Method and Description
      static <T> TSink invokeForEach(TStream<T> stream, java.lang.String kind, com.google.gson.JsonObject invokeInfo, Consumer<T> logic, TupleSerializer tupleSerializer, java.util.Map<java.lang.String,java.lang.Object> parameters)
      Invoke a functional for each operator consuming a single stream.
      static <T,R> TStream<?> invokePipe(java.lang.String kind, TStream<T> stream, com.google.gson.JsonObject invokeInfo, Consumer<T> logic, java.lang.reflect.Type tupleType, TupleSerializer inputSerializer, TupleSerializer outputSerializer, java.util.Map<java.lang.String,java.lang.Object> parameters)
      Invoke a functional map operator consuming a single input stream and producing a single output stream.
      static java.util.List<TStream<?>> invokePrimitive(TopologyElement te, java.lang.String kind, java.util.List<TStream<?>> streams, com.google.gson.JsonObject invokeInfo, ObjIntConsumer<java.lang.Object> logic, java.util.List<java.lang.reflect.Type> tupleTypes, java.util.List<TupleSerializer> inputSerializers, java.util.List<TupleSerializer> outputSerializers, java.util.Map<java.lang.String,java.lang.Object> parameters)
      Invoke a functional operator consuming an arbitrary number of input streams and producing an arbitrary number of output streams.
      static <T> TStream<T> invokeSource(Topology topology, java.lang.String kind, com.google.gson.JsonObject invokeInfo, Supplier<java.lang.Iterable<T>> logic, java.lang.reflect.Type tupleType, TupleSerializer outputSerializer, java.util.Map<java.lang.String,java.lang.Object> parameters)
      Invoke a functional source operator that generates a single stream.
      static void setBuildConfig(Topology topology, com.google.gson.JsonObject buildConfig)
      Set the build configuration.
      static void setFunctionalNamespace(Topology topology, java.lang.String namespace)
      Set the functional namespace for Java functional operators for a topology.
    • Method Detail

      • invokeSource

        static <T> TStream<T> invokeSource(Topology topology,
                                           java.lang.String kind,
                                           com.google.gson.JsonObject invokeInfo,
                                           Supplier<java.lang.Iterable<T>> logic,
                                           java.lang.reflect.Type tupleType,
                                           TupleSerializer outputSerializer,
                                           java.util.Map<java.lang.String,java.lang.Object> parameters)
        Invoke a functional source operator that generates a single stream.
        Parameters:
        topology - Topology the operator will be invoked in.
        kind - Java functional operator kind.
        invokeInfo - Operator invocation information.
        logic - Functional logic.
        tupleType - Type of tuples for the returned stream.
        outputSerializer - How output tuples are serialized.
        parameters - Additional SPL operator parameters.
        Returns:
        Stream produced by the source operator invocation.
      • invokeForEach

        static <T> TSink invokeForEach(TStream<T> stream,
                                       java.lang.String kind,
                                       com.google.gson.JsonObject invokeInfo,
                                       Consumer<T> logic,
                                       TupleSerializer tupleSerializer,
                                       java.util.Map<java.lang.String,java.lang.Object> parameters)
        Invoke a functional for each operator consuming a single stream.
        Parameters:
        stream - Stream to be consumed.
        kind - Java functional operator kind.
        invokeInfo - Operator invocation information.
        logic - Functional logic.
        tupleSerializer - How tuples are serialized.
        parameters - Additional SPL operator parameters.
        Returns:
        Sink for the terminating logic.
      • invokePipe

        static <T,R> TStream<?> invokePipe(java.lang.String kind,
                                           TStream<T> stream,
                                           com.google.gson.JsonObject invokeInfo,
                                           Consumer<T> logic,
                                           java.lang.reflect.Type tupleType,
                                           TupleSerializer inputSerializer,
                                           TupleSerializer outputSerializer,
                                           java.util.Map<java.lang.String,java.lang.Object> parameters)
        Invoke a functional map operator consuming a single input stream and producing a single output stream.
        Parameters:
        kind - Java functional operator kind.
        stream - Single input stream.
        invokeInfo - Operator invocation information.
        logic - Logic performed against each tuple.
        tupleType - Type of tuples for the returned stream.
        inputSerializer - How input tuples are serialized.
        outputSerializer - How output tuples are serialized.
        Returns:
        Stream produced by the pipe operator.
      • invokePrimitive

        static java.util.List<TStream<?>> invokePrimitive(TopologyElement te,
                                                          java.lang.String kind,
                                                          java.util.List<TStream<?>> streams,
                                                          com.google.gson.JsonObject invokeInfo,
                                                          ObjIntConsumer<java.lang.Object> logic,
                                                          java.util.List<java.lang.reflect.Type> tupleTypes,
                                                          java.util.List<TupleSerializer> inputSerializers,
                                                          java.util.List<TupleSerializer> outputSerializers,
                                                          java.util.Map<java.lang.String,java.lang.Object> parameters)
        Invoke a functional operator consuming an arbitrary number of input streams and producing an arbitrary number of output streams.
        Parameters:
        te - Topology element.
        kind - Java functional operator kind.
        streams - Input streams.
        invokeInfo - Operator invocation information.
        logic - Logic to invoke for each input tuple.
        tupleTypes - Tuple types for the output stream.
        inputSerializers - How input tuples are serialized.
        outputSerializers - How output tuples are serialized.
        parameters - Parameters for the operator invocation.
        Returns:
        Streams produced by the primitive operator.
      • setFunctionalNamespace

        static void setFunctionalNamespace(Topology topology,
                                           java.lang.String namespace)
        Set the functional namespace for Java functional operators for a topology. This is used to ensure the topologies declared using an SPI toolkit invoke its own versions of the operators from this topology toolkit. For example HashAdder, HashRemover etc. This means: * The operators are in-sync with the topology definition * The share the same class loader as any other operators provided by the toolkit using the SPI. This must be called immediately after the Topology is created.
      • setBuildConfig

        static void setBuildConfig(Topology topology,
                                   com.google.gson.JsonObject buildConfig)
        Set the build configuration. Build configuration that is tied to a topology.
        Build service originator Value for the key originator is the build service originator. It provides tracking information in Streaming Analytics build service on IBM Cloud. it is ignored for other submission contexts. The format is tool[-version:language[-version so that version information is optional. An example is topology-1.11.8:java-1.8.0.
        Parameters:
        topology - Topology to set build configuration.
        buildConfig - JSON build configuration.
        Since:
        1.11
streamsx.topology 2.1 @ IBMStreams GitHub