diff --git a/streams/src/main/java/org/apache/kafka/streams/processor/internals/ForwardingDisabledProcessorContext.java b/streams/src/main/java/org/apache/kafka/streams/processor/internals/ForwardingDisabledProcessorContext.java index ba3936897f9a7..2b8043a9714e3 100644 --- a/streams/src/main/java/org/apache/kafka/streams/processor/internals/ForwardingDisabledProcessorContext.java +++ b/streams/src/main/java/org/apache/kafka/streams/processor/internals/ForwardingDisabledProcessorContext.java @@ -40,6 +40,11 @@ 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 Cancellable schedule(final Duration interval, @Override public void forward(final K key, final V value) { - throw new StreamsException("ProcessorContext#forward() not supported."); + throw new StreamsException(EXPLANATION); } @Override public 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 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 void forward(final K key, final V value, final String childName) { - throw new StreamsException("ProcessorContext#forward() not supported."); + throw new StreamsException(EXPLANATION); } @Override