MINOR: Add explanation for disabling forwarding from value transformers
Reviewers: Matthias J. Sax Bill Bejeck
@@ -40,6 +40,11 @@ import java.util.Objects;
public final class ForwardingDisabledProcessorContext implements ProcessorContext {
private final ProcessorContext delegate;
+ private static final String EXPLANATION = "ProcessorContext#forward() is not supported from this context, "
+ + "as the framework must ensure the key is not changed (#forward allows changing the key on "
+ + "messages which are sent). Try another function, which doesn't allow the key to be changed "
+ + "(for example - #tranformValues).";
+
public ForwardingDisabledProcessorContext(final ProcessorContext delegate) {
this.delegate = Objects.requireNonNull(delegate, "delegate");
}
@@ -102,24 +107,24 @@ public final class ForwardingDisabledProcessorContext implements ProcessorContex
@Override
public <K, V> void forward(final K key, final V value) {
- throw new StreamsException("ProcessorContext#forward() not supported.");
+ throw new StreamsException(EXPLANATION);
}
@Override
public <K, V> void forward(final K key, final V value, final To to) {
- throw new StreamsException("ProcessorContext#forward() not supported.");
+ throw new StreamsException(EXPLANATION);
}
@Override
@Deprecated
public <K, V> void forward(final K key, final V value, final int childIndex) {
- throw new StreamsException("ProcessorContext#forward() not supported.");
+ throw new StreamsException(EXPLANATION);
}
@Override
@Deprecated
public <K, V> void forward(final K key, final V value, final String childName) {
- throw new StreamsException("ProcessorContext#forward() not supported.");
+ throw new StreamsException(EXPLANATION);
}
@Override
