Search in sources :

Example 1 with RootOperatorImpl

use of org.apache.samza.operators.impl.RootOperatorImpl 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)

Aggregations

RootOperatorImpl (org.apache.samza.operators.impl.RootOperatorImpl)1 InputStreamInternal (org.apache.samza.operators.stream.InputStreamInternal)1 SystemStream (org.apache.samza.system.SystemStream)1