ServiceBusQueueTrigger MessageReceiver Binding throws error
musa-pro opened this issue · 4 comments
I was trying to get metadata MessageReceiver for a ServiceBusQueueTrigger function using binding annotation, but this throws error. I noticed MessageSession, DeadletterSource throws error too whereas other binding works well. I was following this document
https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-service-bus-trigger?tabs=java
Is this expected or what I'm doing wrong?
Here is what I've
@FunctionName("MessageConsumer")
public void run(
@ServiceBusQueueTrigger(name = "msg",
queueName = "ServiceBusQueue",
connection = "ServiceBusConStr")
String message,
@BindingName("MessageReceiver") MessageReceiver messageReceiver,
@BindingName("UserProperties") Map<String, Object> properties,
final ExecutionContext context
){
context.getLogger().info("got message from: "+message);
}
this worked for me:
@BindingName("ApplicationProperties") Map<String, Object> properties,
I took binding name from this list: https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-service-bus-trigger?tabs=in-process%2Cextensionv5&pivots=programming-language-csharp#message-metadata
Hi @avs099, thanks for your sharing, I have the same issue, and tried your suggestion, but not work for me. and the shared link is for C# not Java. attached the code and error logs.
@PengChaoSun , I cannot reproduce your issue with the same code, can you double check if your function is defined correctly?