azure-functions-java-worker
azure-functions-java-worker copied to clipboard
ServiceBusQueueTrigger IMessageReceiver Binding for Java throws error
I am using an ServiceBusQueeue Triggered azure function in Java. I have disabled the "autoComplete" message because i want to receive the message and manually complete it. I am trying to make use of "IMessageReceiver" to manually complete the message after it is received and processed.
Im getting below error :
[2022-08-19T11:34:52.340Z] Executed 'Functions.Test-Function' (Failed, Id=4de94ccd-5c33-4263-a452-fe4a8e2ee446, Duration=213ms)
[2022-08-19T11:34:52.340Z] System.Private.CoreLib: Exception while executing function: Functions.Test-Function. System.Private.CoreLib: Result: Failure
Exception: NullPointerException:
Stack: java.lang.NullPointerException
[2022-08-19T11:34:52.340Z] at com.microsoft.azure.functions.worker.binding.BindingDataStore.getTriggerMetatDataByName(BindingDataStore.java:66)
[2022-08-19T11:34:52.340Z] at com.microsoft.azure.functions.worker.broker.ParameterResolver.resolve(ParameterResolver.java:62)
[2022-08-19T11:34:52.340Z] at com.microsoft.azure.functions.worker.broker.ParameterResolver.resolve(ParameterResolver.java:42)
[2022-08-19T11:34:52.341Z] at com.microsoft.azure.functions.worker.broker.JavaMethodExecutorImpl.execute(JavaMethodExecutorImpl.java:50)
[2022-08-19T11:34:52.341Z] at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.invokeMethod(JavaFunctionBroker.java:62)
[2022-08-19T11:34:52.341Z] at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:33)
[2022-08-19T11:34:52.341Z] at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:10)
[2022-08-19T11:34:52.341Z] at com.microsoft.azure.functions.worker.handler.MessageHandler.handle(MessageHandler.java:45)
[2022-08-19T11:34:52.341Z] at com.microsoft.azure.functions.worker.JavaWorkerClient$StreamingMessagePeer.lambda$onNext$0(JavaWorkerClient.java:92)
[2022-08-19T11:34:52.341Z] at com.microsoft.azure.functions.worker.JavaWorkerClient$StreamingMessagePeer$$Lambda$20.0000000000876BD0.run(Unknown Source)
[2022-08-19T11:34:52.342Z] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[2022-08-19T11:34:52.342Z] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[2022-08-19T11:34:52.342Z] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[2022-08-19T11:34:52.342Z] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[2022-08-19T11:34:52.342Z] at java.lang.Thread.run(Thread.java:813)
[2022-08-19T11:34:52.342Z] .
Is there anything wrong that I am doing ?
Below is my host.json file:
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[2.*, 3.0.0)"
},
"extensions": {
"serviceBus": {
"messageHandlerOptions": {
"autoComplete": false,
"maxConcurrentCalls": 1
}
}
}
}
Source
public class TestFunction {
@FunctionName("Test-Function")
public void run(
@ServiceBusQueueTrigger(name = "Message", queueName = "test_queue",
connection = "TestServiceBusConnection") String Message , @BindingName("IMessageReceiver") IMessageReceiver messageReceiver,
final ExecutionContext context
) {
context.getLogger().info("Received message: " + Message);
}
}
Investigative information-
- Timestamp: 2022-08-19T12:22:40.552Z
- Invocation ID: bcc5f58a-e10b-41c7-b98a-88fc205050fa
- Region: Central US
Related information -
- Programming language used - Java8
- Bindings used - @ServiceBusQueueTrigger
Hi @M-Mendonca , can you share how you IMessageReceiver
class is defined and any document you use to create it?
The binding name should be @BindingName("MessageReceiver")
, please let me know which document you are referring so I can help to update it with correct binding name. Thanks.
Haven't get response for more than 1 month. Will close the issue. Please reopen it if you still have the issue.