Skip to content

Commit 484aa6d

Browse files
authored
Merge pull request #96936 from PramodValavala-MSFT/patch-76
(AzureCXP) add java sample
2 parents a7005ee + 858ee2e commit 484aa6d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

articles/azure-functions/functions-bindings-return-value.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ This article explains how return values work inside a function.
1515
In languages that have a return value, you can bind a function [output binding](./functions-triggers-bindings.md#binding-direction) to the return value:
1616

1717
* In a C# class library, apply the output binding attribute to the method return value.
18+
* In Java, apply the output binding annotation to the function method.
1819
* In other languages, set the `name` property in *function.json* to `$return`.
1920

2021
If there are multiple output bindings, use the return value for only one of them.
@@ -148,6 +149,24 @@ def main(input: azure.functions.InputStream) -> str:
148149
})
149150
```
150151

152+
# [Java](#tab/java)
153+
154+
Here's Java code that uses the return value for an output binding:
155+
156+
```java
157+
@FunctionName("QueueTrigger")
158+
@StorageAccount("AzureWebJobsStorage")
159+
@BlobOutput(name = "output", path = "output-container/{id}")
160+
public static String run(
161+
@QueueTrigger(name = "input", queueName = "inputqueue") WorkItem input,
162+
final ExecutionContext context
163+
) {
164+
String json = String.format("{ \"id\": \"%s\" }", input.id);
165+
context.getLogger().info("Java processed queue message. Item=" + json);
166+
return json;
167+
}
168+
```
169+
151170
---
152171

153172
## Next steps

0 commit comments

Comments
 (0)