When I tried to implement a task which does kinda dispatching to
downstream processors or sinks, looks like relying on
context.forward(K, V, int childIndex) is the only way now.
I have a question why this method implemented using childIndex(which
is just an index of children "List" that based on order of
builder.addProcessor() call) instead of child name(first argument to
add{Processor,Sink}).
I wanna ask what is the concrete use case of forward(K, V, int
childIndex) and is it makes sense to introduce another overload:
forward(K, V, String childName) for much handy use.
Currently I have a use-case like this in my mind:
```
builder.addProcessor("DispatchProcess", new
DispatchProcessorSupplier(), "Source");
builder.addProcessor("Process-A", new ProcessorASupplier(), "DispatchProcess");
builder.addProcessor("Process-B", new ProcessorBSupplier(), "DispatchProcess");

// in process(key, value)
if ("key-for-A".equals(key)) {
    context.forward(key, value, "Process-A");
} else if ("key-for-B".equals(key)) {
    context.forward(key, value, "Process-B");
}
```

Reply via email to