david-streamlio opened a new issue #6931:
URL: https://github.com/apache/pulsar/issues/6931
**Describe the bug**
The LocalRunner class does not start a local thread runner instance for Java
functions.
**To Reproduce**
Steps to reproduce the behavior:
1. Create an instance of the LocalRunner class inside a Java class
2. Initialize it like so.
` FunctionConfig functionConfig =
FunctionConfig.builder()
.className(WordCountFunction.class.getName())
.inputs(Collections.singleton(TOPIC))
.inputSpecs(inputSpecs)
.maxPendingAsyncRequests(Integer.valueOf(500))
.name("word-counter")
.runtime(FunctionConfig.Runtime.JAVA)
.build();
LocalRunner localRunner =
LocalRunner.builder()
.brokerServiceUrl(BROKER_URL)
.stateStorageServiceUrl("bk://localhost:4181")
.functionConfig(functionConfig)
.build();
localRunner.start(true);`
3. Attach to the process with a debugger and set a breakpoint at line 360 of
the LocalRunner class and attempt to step through to line 361
4. See a "silent" NullPointerException is thrown in the following call;
`instanceConfig.setMaxPendingAsyncRequests(functionConfig.getMaxPendingAsyncRequests());`
This is because the call to `getMaxPendingAsyncRequests()` returns null, even
though I set it to a value in the FunctionConfig
**Expected behavior**
One would expect the value I passed in to be set and for the LocalRunner to
start the function inside a local thread
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
**Additional context**
I have the code fix and will attach it to this ticket. Basically the issue
is that there is a default value for that field inside the FunctionConfig class
that is set as a direct assignment. However, since the class is Lombok
annotated, that assignment gets ignored AND prevents assignments from occurring
inside the builder as well.
I have removed that assignment, and added an equivalent logic block to the
`FunctionConfigUtils.inferMissingArguments` method to set a default value of
1000 if none is provided.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]