You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Matthias J. Sax (Jira)" <ji...@apache.org> on 2020/05/23 20:57:00 UTC
[jira] [Created] (KAFKA-10036) Improve error message is user
violates `Supplier` pattern
Matthias J. Sax created KAFKA-10036:
---------------------------------------
Summary: Improve error message is user violates `Supplier` pattern
Key: KAFKA-10036
URL: https://issues.apache.org/jira/browse/KAFKA-10036
Project: Kafka
Issue Type: Improvement
Components: streams
Reporter: Matthias J. Sax
Using the Processor API, uses need to pass in a `ProcessorSupplier` that needs to return new `Processor` instance each time `get()` is called.
Users violate this rule on a regular basis and return the same instance on `get()`. This mistake leads to a (not very informative) `NullPointerException` during runtime. (Cf: [https://stackoverflow.com/questions/61790984/kafka-stream-forward-method-throwing-nullpointerexception-because-processornode/61978396)]
We could improve the error message by checking if `currentNode()` returns `null` ([https://github.com/apache/kafka/blob/2.4/streams/src/main/java/org/apache/kafka/streams/processor/internals/ProcessorContextImpl.java#L183)] and throw an informative error message for this case.
Furthermore, we could do a "sanity" check within `KafkaStreams` constructor before we start the process threads: we get all `Suppliers` for the `Topology` and call `get()` two times on each supplier to compare if the returned object references are different – if they are the same, we throw an informative error message.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)