Search in sources :

Example 1 with InputStreamInternal

use of org.apache.samza.operators.stream.InputStreamInternal in project samza by apache.

the class StreamOperatorTask method process.

/**
   * Passes the incoming message envelopes along to the {@link org.apache.samza.operators.impl.RootOperatorImpl} node
   * for the input {@link SystemStream}.
   * <p>
   * From then on, each {@link org.apache.samza.operators.impl.OperatorImpl} propagates its transformed output to
   * its chained {@link org.apache.samza.operators.impl.OperatorImpl}s itself.
   *
   * @param ime incoming message envelope to process
   * @param collector the collector to send messages with
   * @param coordinator the coordinator to request commits or shutdown
   */
@Override
public final void process(IncomingMessageEnvelope ime, MessageCollector collector, TaskCoordinator coordinator) {
    SystemStream systemStream = ime.getSystemStreamPartition().getSystemStream();
    InputStreamInternal inputStream = inputSystemStreamToInputStream.get(systemStream);
    RootOperatorImpl rootOperatorImpl = operatorImplGraph.getRootOperator(systemStream);
    if (rootOperatorImpl != null) {
        // TODO: SAMZA-1148 - Cast to appropriate input (key, msg) types based on the serde
        // before applying the msgBuilder.
        Object message = inputStream.getMsgBuilder().apply(ime.getKey(), ime.getMessage());
        rootOperatorImpl.onMessage(message, collector, coordinator);
    }
}
Also used : SystemStream(org.apache.samza.system.SystemStream) RootOperatorImpl(org.apache.samza.operators.impl.RootOperatorImpl) InputStreamInternal(org.apache.samza.operators.stream.InputStreamInternal)

Example 2 with InputStreamInternal

use of org.apache.samza.operators.stream.InputStreamInternal in project samza by apache.

the class StreamGraphImpl method getAllOperatorSpecs.

/**
   * Get all {@link OperatorSpec}s available in this {@link StreamGraphImpl}
   *
   * @return  a set of all available {@link OperatorSpec}s
   */
public Collection<OperatorSpec> getAllOperatorSpecs() {
    Collection<InputStreamInternal> inputStreams = inStreams.values();
    Set<OperatorSpec> operatorSpecs = new HashSet<>();
    for (InputStreamInternal stream : inputStreams) {
        doGetOperatorSpecs((MessageStreamImpl) stream, operatorSpecs);
    }
    return operatorSpecs;
}
Also used : OperatorSpec(org.apache.samza.operators.spec.OperatorSpec) InputStreamInternal(org.apache.samza.operators.stream.InputStreamInternal) HashSet(java.util.HashSet)

Aggregations

InputStreamInternal (org.apache.samza.operators.stream.InputStreamInternal)2 HashSet (java.util.HashSet)1 RootOperatorImpl (org.apache.samza.operators.impl.RootOperatorImpl)1 OperatorSpec (org.apache.samza.operators.spec.OperatorSpec)1 SystemStream (org.apache.samza.system.SystemStream)1