I am writing an Azure Function in Java using the Micronaut framework.
My function works perfectly fine if I use the @QueueTrigger
to annotate a String
to receive a message body. However I would also like to process the metadata.
The documentation makes mention of Metadata (https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-queue-trigger?tabs=java#message-metadata) and "suggests" the CloudQueueMessage
class, which doesn't seem to be available in the com.microsoft.azure.funtions:azure-functions-java-library
I even tried including the com.azure:azure-storage-queue
library on the off chance.
(As far as I can tell azure-functions-java-library
hasn't moved over to the com.azure
name space/GAV yet)
Is it possible to obtain the Storage Queue message metadata using Java and if so, what am I missing?
Thanks
It seems that I was missing something, that you can "bind" to properties of the metadata that are held in CloudQueueMessage
class.
So for my use case all I need to do is add the following to the function method:
@BindingName("Id") final String id,
The following links are all to Microsoft documentation, the last one of which is hosted on github.
Trigger Metadata definition
QueueStorage Trigger
Example that actually accesses the metadata