Skip to content

Commit f3b9896

Browse files
committed
Add azure function-catalog support docs
1 parent 59c0fb8 commit f3b9896

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

docs/src/main/asciidoc/adapters/azure-intro.adoc

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,11 @@ dependencies {
5151

5252
NOTE: version `4.0.0+` is required. Having the adapter on the classpath activates the Azure Java Worker integration.
5353

54-
=== Function Implementation
54+
[[azure.development.guidelines]]
55+
=== Development Guidelines
5556

5657
Use the `@Component` (or `@Service`) annotation to turn any exiting Azure Function class (e.g. with `@FunctionName` handlers) into a Spring component.
57-
Then you can auto-wire the required dependencies (or the https://docs.spring.io/spring-cloud-function/docs/current/reference/html/spring-cloud-function.html#_function_catalog_and_flexible_function_signatures[FunctionCatalog] for Spring Cloud Function composition) and use those inside the Azure function handlers.
58+
Then you can auto-wire the required dependencies (or the <<spring-cloud-function.adoc#function.catalog,Function Catalog>> for Spring Cloud Function composition) and use those inside the Azure function handlers.
5859

5960
[source,java]
6061
----
@@ -95,7 +96,7 @@ When invoked by a trigger (such as `@HttpTrigger`), functions process that trigg
9596
<4> The `plainBean` method handler is mapped to an Azure function that uses of the auto-wired `uppercase` spring bean to compute the result.
9697
It demonstrates how to use "plain" Spring components in your Azure handlers.
9798
<5> The `springCloudFunction` method handler is mapped to another Azure function, that uses the auto-wired `FunctionCatalog` instance to compute the result.
98-
<6> Shows how to leverage the Spring Cloud Function https://docs.spring.io/spring-cloud-function/docs/current/reference/html/spring-cloud-function.html#_function_catalog_and_flexible_function_signatures[FunctionCatalog] composition API.
99+
<6> Shows how to leverage the Spring Cloud Function <<spring-cloud-function.adoc#function.catalog,Function Catalog>> composition API.
99100

100101
TIP: Use the Java annotations included in the https://learn.microsoft.com/en-us/java/api/com.microsoft.azure.functions.annotation?view=azure-java-stable[com.microsoft.azure.functions.annotation.*] package to bind input and outputs to your methods.
101102

@@ -126,6 +127,16 @@ public class HttpTriggerDemoApplication {
126127
<1> The `@SpringBootApplication` annotated class is used as a `Main-Class` as explained in <<star-class-configuration, main class configuration>>.
127128
<2> Functions auto-wired and used in the Azure function handlers.
128129

130+
==== Function Catalog
131+
132+
The Spring Cloud Function supports a range of type signatures for user-defined functions, while providing a consistent execution model.
133+
For this it uses the <<spring-cloud-function.adoc#function.catalog,Function Catalog>> to transform all user defined functions into a canonical representation.
134+
135+
The Azure adapter can auto-wire any Spring component, such as the `uppercase` above.
136+
But those are treated as plain Java class instances, not as a canonical Spring Cloud Functions!
137+
138+
To leverage Spring Cloud Function and have access to the canonical function representations, you need to auto-wire the `FunctionCatalog` and use it in your handler, like the `functionCatalog` instance the `springCloudFunction()` handler above.
139+
129140
==== Accessing Azure ExecutionContext
130141

131142
Some time there is a need to access the target execution context provided by the Azure runtime in the form of `com.microsoft.azure.functions.ExecutionContext`.
@@ -164,6 +175,7 @@ public Function<Message<String>, String> uppercase(JsonMapper mapper) {
164175
----
165176
<1> Retrieve the ExecutionContext instance from the header.
166177

178+
167179
[[azure.configuration]]
168180
=== Configuration
169181

@@ -510,4 +522,12 @@ WARNING: The legacy `FunctionInvoker` programming model is deprecated and will n
510522

511523
For additional documentation and samples about the Function Integration approach follow the https://github.com/spring-cloud/spring-cloud-function/tree/main/spring-cloud-function-samples/function-sample-azure/[azure-sample] README and code.
512524

525+
== Relevant Links
526+
527+
- https://learn.microsoft.com/en-us/azure/developer/java/spring-framework/getting-started-with-spring-cloud-function-in-azure[Spring Cloud Function in Azure]
528+
- https://spring.io/blog/2023/02/24/spring-cloud-function-for-azure-function[Spring Cloud Function for Azure Function (blog)]
529+
- <<spring-cloud-function.adoc#,Spring Cloud Function - Reference Guide>>
530+
- https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-java?tabs=bash%2Cconsumption[Azure Functions Java developer guide]
531+
- https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference?tabs=blob[Azure Functions developer guide]
532+
513533
:sectnums!:

docs/src/main/asciidoc/spring-cloud-function.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ include::getting-started.adoc[]
2424

2525
== Programming model
2626

27+
[[function.catalog]]
2728

2829
=== Function Catalog and Flexible Function Signatures
2930

0 commit comments

Comments
 (0)