Bindings not working
edufsrj opened this issue · 1 comments
I have a function using QueueTrigger and I want to get some metadata info:
@FunctionName("func-name") public void run( @ServiceBusQueueTrigger( name = "message", queueName = "%SERVICE_BUS_QUEUE_NAME%", connection = "some connection details" ) String message, //@BindingName("ApplicationProperties") Map<String, String> applicationProperties, //@BindingName("DeliveryCount") int deliveryCount, @BindingName("MessageId") String messageId, //@BindingName("deadLetterSource") String deadLetterSource, //@BindingName("status") String status, final ExecutionContext context )
The only data that I'm able to retrieve is the message MessageId. If I uncomment any of the other bindings, I get the following error:
Cannot find matched @BindingName of customer function, please check if customer function is defined correctly
But when I go to the queue and select a message and go to the tab Message Properties, I can see the properties but for some reason I'm not able to get it. Any hints of what might be?
I see the properties from the Dead letter queue and I'm resending the message to the queue.
I tried this to ServiceBus Topic Trigger and works to access the custom properties in the message:
public class ServiceBusResponseProcess {
@FunctionName("ServiceBusTopicResponseProcess")
public void run(
@ServiceBusTopicTrigger(
name = "message",
topicName = "topic-name",
subscriptionName = "subs-name",
connection = "BUS_CONNECTION_STRING"
) String message,
@BindingName("UserProperties") Map<String, Object> userProperties,
final ExecutionContext context
) {
context.getLogger().info(message);
context.getLogger().info("UserProperties: " + userProperties.toString());
}