anonymous user There is no way to get the queue name when using an output binding. Like you said, it can be an environment variable, so the only way would be to get it from there directly in your code.
AzureFunction in JAVA - Getting QueueName from output binding
My question regards Azure FunctionApp run in JAVA that uses Azure Queue Storage as function output.
There is a sample in Microsoft doc (source: https://video2.skills-academy.com/en-us/azure/azure-functions/functions-bindings-storage-queue-output?tabs=java#example)
@FunctionName("httpToQueue")
@QueueOutput(name = "item", queueName = "myqueue-items", connection = "MyStorageConnectionAppSetting")
public String pushToQueue(
@HttpTrigger(name = "request", methods = {HttpMethod.POST}, authLevel = AuthorizationLevel.ANONYMOUS) final String message,
@HttpOutput(name = "response") final OutputBinding<String> result) {
result.setValue(message + " has been added.");
return message;
}
Is it possible to get the Queue Name from the "result" output?
It means, I would like to get the "request" variable in abovementioned sample.
I would need it for logging purposes. The name of Queue can be parametrized and set as environment variable as well, so getting the name of output queue from the "result" variable is the safest way, I suppose.
-
Pramod Valavala 20,626 Reputation points Microsoft Employee
2021-11-23T04:33:10.147+00:00