Search in sources :

Example 1 with MuxSink

use of com.datatorrent.stram.debug.MuxSink in project apex-core by apache.

the class Node method addSinks.

@SuppressWarnings({ "unchecked" })
public void addSinks(Map<String, Sink<Object>> sinks) {
    boolean changes = false;
    for (Entry<String, Sink<Object>> e : sinks.entrySet()) {
        /* make sure that we ignore all the input ports */
        PortContextPair<OutputPort<?>> pcpair = descriptor.outputPorts.get(e.getKey());
        if (pcpair == null) {
            continue;
        }
        changes = true;
        Sink<Object> ics = outputs.get(e.getKey());
        if (ics == null) {
            pcpair.component.setSink(e.getValue());
            outputs.put(e.getKey(), e.getValue());
            changes = true;
        } else if (ics instanceof MuxSink) {
            ((MuxSink) ics).add(e.getValue());
        } else {
            MuxSink muxSink = new MuxSink(ics, e.getValue());
            pcpair.component.setSink(muxSink);
            outputs.put(e.getKey(), muxSink);
            changes = true;
        }
    }
    if (changes) {
        activateSinks();
    }
}
Also used : OutputPort(com.datatorrent.api.Operator.OutputPort) MuxSink(com.datatorrent.stram.debug.MuxSink) Sink(com.datatorrent.api.Sink) MuxSink(com.datatorrent.stram.debug.MuxSink)

Aggregations

OutputPort (com.datatorrent.api.Operator.OutputPort)1 Sink (com.datatorrent.api.Sink)1 MuxSink (com.datatorrent.stram.debug.MuxSink)1