You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -492,6 +492,18 @@ This setting enables the Python worker to use shared memory to improve throughpu
492
492
493
493
With this setting enabled, you can use the [DOCKER_SHM_SIZE](#docker_shm_size) setting to set the shared memory size. To learn more, see [Shared memory](functions-reference-python.md#shared-memory).
494
494
495
+
## JAVA_ENABLE_SDK_TYPES
496
+
497
+
Enables your function app to use native Azure SDK types in bindings.
For more information, see [SDK types](functions-reference-java.md#sdk-types) in the Java reference article
506
+
495
507
## JAVA_OPTS
496
508
497
509
Used to customize the Java virtual machine (JVM) used to run your Java functions when running on a [Premium plan](./functions-premium-plan.md) or [Dedicated plan](./dedicated-plan.md). When running on a Consumption plan, instead use `languageWorkers__java__arguments`. For more information, see [Customize JVM](functions-reference-java.md#customize-jvm).
| Host downloads blob, sends it to the worker. | Worker streams from Storage itself – lower latency & memory. |
603
-
| 100 MB size limit. | No hard limit; streams as big as Storage allows. |
604
-
| Only read/write bytes. | Full SDK surface: metadata, ACLs, legal hold, etc. |
605
-
606
-
### What you need
607
-
608
-
* Turn the feature on by setting `JAVA_ENABLE_SDK_TYPES` to `"true"` in your
609
-
app's settings.
610
-
***azure-functions-maven-plugin** (or Gradle plug-in) ≥ **1.38.0** – detects SDK-type parameters during build and adds the flag that activates the middleware.
611
-
* Your function app must reference:
612
-
613
-
*`azure-storage-blob` (always)
614
-
*`azure-identity` (only if you plan to use Managed Identity)
615
-
616
-
> The worker creates clients via reflection, so it relies on whatever Storage/Identity libraries you ship with the function.
617
-
618
-
### Authoring – it looks just like a normal binding
*`dataType` on **@BlobTrigger** is **ignored** when you bind to an SDK-type.
667
-
*`connection` can be a connection string **or** an identity-based prefix – both work with SDK-types.
668
-
669
-
### What happens under the hood (in one minute)
670
-
671
-
1.**Build:** the Maven plug-in scans your methods. If it sees `BlobClient` or `BlobContainerClient` it writes `"supportsDeferredBinding": true` into `function.json`.
672
-
2.**Startup:** the worker notices the flag and inserts **SdkTypeMiddleware** before your function executes.
673
-
3.**Invocation:** for each SDK-typed parameter the middleware
674
-
675
-
* reads the binding metadata,
676
-
* looks in the **WorkerObjectCache**; if no entry exists it uses reflection to construct the client,
677
-
* injects the client into the argument list.
678
-
679
-
The cache key is derived from container name + blob name (or just container, for `BlobContainerClient`) plus the connection prefix. Thus identical invocations reuse one client; distinct blobs get their own.
680
-
681
-
682
-
### Managed Identity
683
-
684
-
SDK-types honor the same identity-based connection settings you already use with classic bindings.
685
-
Simply point `connection` to an MI prefix and add `azure-identity` to your function’s dependencies – the worker will build `DefaultAzureCredential` reflectively.
|`SdkHydrationException`| Middleware failed to build the SDK client (missing env-vars, reflection error, credential failure). |
695
-
|`SdkTypeCreationException`| Factory couldn’t turn metadata into the final SDK-type (usually casting issues). |
696
-
697
-
Check the inner message for the exact cause; most issues are mis-spelled environment variables or missing dependencies.
698
-
699
-
### Future work
700
-
701
-
This is the **first** SDK-type preview. We plan to:
702
-
703
-
* Add more Storage client types, then branch into Cosmos DB, Event Hubs, etc.
704
-
* Promote the feature to General Availability once telemetry shows it’s solid.
705
-
706
-
Give it a try in a test function app and tell us how much faster your blob processing becomes!
707
-
708
-
::: zone-end
709
-
710
589
## host.json properties
711
590
712
591
The [host.json](functions-host-json.md#blobs) file contains settings that control blob trigger behavior. See the [host.json settings](functions-bindings-storage-blob.md#hostjson-settings) section for details regarding available settings.
@@ -142,7 +142,7 @@ Here's the generated corresponding `function.json` by the [azure-functions-maven
142
142
143
143
## Java versions
144
144
145
-
The version of Java on which your app runs in Azure is specified in the pom.xml file. The Maven archetype currently generates a pom.xml for Java 8, which you can change before publishing. The Java version in pom.xml should match the version on which you've locally developed and tested your app.
145
+
The version of Java on which your app runs in Azure is specified in the pom.xml file. The Maven archetype currently generates a pom.xml for Java 8, which you can change before publishing. The Java version in pom.xml should match the version of Java on which you develop and test your app locally.
146
146
147
147
### Supported versions
148
148
@@ -158,7 +158,7 @@ Unless you specify a Java version for your deployment, the Maven archetype defau
158
158
159
159
### Specify the deployment version
160
160
161
-
You can control the version of Java targeted by the Maven archetype by using the `-DjavaVersion` parameter. The value of this parameter can be either `8`, `11`, `17` or `21`.
161
+
You can control the version of Java targeted by the Maven archetype by using the `-DjavaVersion` parameter. This parameter must match [supported Java versions](supported-languages.md?pivots=programming-language-java#languages-by-runtime-version).
162
162
163
163
The Maven archetype generates a pom.xml that targets the specified Java version. The following elements in pom.xml indicate the Java version to use:
164
164
@@ -269,7 +269,9 @@ The `com.microsoft.azure.functions:azure-functions-java-library` dependency is p
269
269
270
270
## Data type support
271
271
272
-
You can use Plain old Java objects (POJOs), types defined in `azure-functions-java-library`, or primitive data types such as String and Integer to bind to input or output bindings.
272
+
You can use plain-old Java objects (POJOs), types defined in `azure-functions-java-library`, or primitive data types such as `String` and `Integer` to bind to input or output bindings.
@@ -293,6 +295,91 @@ Bind binary inputs or outputs to `byte[]`, by setting the `dataType` field in yo
293
295
294
296
If you expect null values, use `Optional<T>`.
295
297
298
+
### SDK types (preview)
299
+
300
+
You can currently use these native SDK types in your bindings:
301
+
302
+
+ Blob Storage SDK: `BlobClient` and `BlobContainerClient`
303
+
304
+
When you use these native SDK types, your functions can use client types to access streams directly from storage, which provides these benefits over POJOs or binary types:
305
+
306
+
+ Lower latency
307
+
+ Reduced memory requirements
308
+
+ Removes request-based size limits (uses service defaults)
309
+
+ Provides access to the full SDK surface: metadata, ACLs, legal holds, and other SDK-specific data.
310
+
311
+
#### Requirements
312
+
313
+
* Set the [`JAVA_ENABLE_SDK_TYPES`](./functions-app-settings.md#java_enable_sdk_types) app setting to `true` to enable SDK types.
314
+
*`azure-functions-maven-plugin` (or Gradle plug-in) version `1.38.0` or a higher version.
+ The `dataType` setting on `@BlobTrigger` is ignored when binding to an SDK type.
367
+
+ Currently, only one SDK type can be used at a time in a given function definition. If your function has both a Blog trigger or Input binding and a Blob output binding, one binding can use an SDK type (such as `BlobClient`) and the others must use a native type or POJO.
368
+
+ You can use managed identities with SDK types.
369
+
370
+
#### Troubleshooting
371
+
372
+
These are potential errors that might occur when using SDK types:
373
+
374
+
| Exception | Meaning |
375
+
| ----- | ----- |
376
+
|`SdkAnalysisException`| Build plug-in couldn’t create metadata. This might be due to duplicate SDK-types in a single function definition, an unsupported parameter type, or some other misconfiguration. |
377
+
|`SdkRegistryException`| Runtime doesn’t recognize the stored FQCN, which can be caused by mismatched library versions. |
378
+
|`SdkHydrationException`| Middleware failed to build the SDK client, which can occur due to missing environment variables, reflection errors, credential failures, and similar runtime issues. |
379
+
|`SdkTypeCreationException`| Factory couldn’t turn metadata into the final SDK type, which is usually caused by a casting issues. |
380
+
381
+
Check the inner message for more details about the exact cause. Most SDK types issues are caused by misspelled environment variable names or missing dependencies.
382
+
296
383
## Bindings
297
384
298
385
Input and output bindings provide a declarative way to connect to data from within your code. A function can have multiple input and output bindings.
@@ -415,7 +502,7 @@ You invoke this function on an `HttpRequest` object. It writes multiple values t
415
502
416
503
## HttpRequestMessage and HttpResponseMessage
417
504
418
-
These are defined in `azure-functions-java-library`. They're helper types to work with HttpTrigger functions.
505
+
These helper types, which are designed to work with HTTP Trigger functions, are defined in `azure-functions-java-library`:
@@ -465,7 +552,7 @@ In the preceding example, the `queryValue` is bound to the query string paramete
465
552
466
553
## Execution context
467
554
468
-
`ExecutionContext`, defined in the `azure-functions-java-library`, contains helper methods to communicate with the functions runtime. For more information, see the [ExecutionContext reference article](/java/api/com.microsoft.azure.functions.executioncontext).
555
+
`ExecutionContext`, defined in the `azure-functions-java-library`, contains helper methods that are used to communicate with the functions runtime. For more information, see the [ExecutionContext reference article](/java/api/com.microsoft.azure.functions.executioncontext).
469
556
470
557
### Logger
471
558
@@ -532,7 +619,7 @@ To download the log files as a single ZIP file by using the Azure CLI, open a ne
532
619
az webapp log download --resource-group resourcegroupname --name functionappname
533
620
```
534
621
535
-
You must have enabled file system logging in the Azure portal or the Azure CLI before running this command.
622
+
You must enable file system logging in the Azure portal or the Azure CLI before running this command.
536
623
537
624
## Environment variables
538
625
@@ -552,7 +639,7 @@ public class Function {
552
639
```
553
640
## Use dependency injection in Java Functions
554
641
555
-
Azure Functions Java supports the dependency injection (DI) software design pattern, which is a technique to achieve [Inversion of Control (IoC)](/dotnet/architecture/modern-web-apps-azure/architectural-principles#dependency-inversion) between classes and their dependencies. Java Azure Functions provides a hook to integrate with popular Dependency Injection frameworks in your Functions Apps. [Azure Functions Java SPI](https://github.com/Azure/azure-functions-java-additions/tree/dev/azure-functions-java-spi) contains an interface [FunctionInstanceInjector](https://github.com/Azure/azure-functions-java-additions/blob/dev/azure-functions-java-spi/src/main/java/com/microsoft/azure/functions/spi/inject/FunctionInstanceInjector.java). By implementing this interface, you can return an instance of your function class and your functions will be invoked on this instance. This gives frameworks like [Spring](/azure/developer/java/spring-framework/getting-started-with-spring-cloud-function-in-azure?toc=%2Fazure%2Fazure-functions%2Ftoc.json), [Quarkus](/azure/azure-functions/functions-create-first-quarkus), Google Guice, Dagger, etc. the ability to create the function instance and register it into their IOC container. This means you can use those Dependency Injection frameworks to manage your functions naturally.
642
+
Azure Functions Java supports the dependency injection (DI) software design pattern, which is a technique to achieve [Inversion of Control (IoC)](/dotnet/architecture/modern-web-apps-azure/architectural-principles#dependency-inversion) between classes and their dependencies. Java Azure Functions provides a hook to integrate with popular Dependency Injection frameworks in your Functions Apps. [Azure Functions Java SPI](https://github.com/Azure/azure-functions-java-additions/tree/dev/azure-functions-java-spi) contains an interface [FunctionInstanceInjector](https://github.com/Azure/azure-functions-java-additions/blob/dev/azure-functions-java-spi/src/main/java/com/microsoft/azure/functions/spi/inject/FunctionInstanceInjector.java). By implementing this interface, you can return an instance of your function class and your functions are invoked on this instance. This gives frameworks like [Spring](/azure/developer/java/spring-framework/getting-started-with-spring-cloud-function-in-azure?toc=%2Fazure%2Fazure-functions%2Ftoc.json), [Quarkus](/azure/azure-functions/functions-create-first-quarkus), Google Guice, Dagger, etc. the ability to create the function instance and register it into their IOC container. This means you can use those Dependency Injection frameworks to manage your functions naturally.
556
643
557
644
> [!NOTE]
558
645
> Microsoft Azure Functions Java SPI Types ([azure-function-java-spi](https://mvnrepository.com/artifact/com.microsoft.azure.functions/azure-functions-java-spi/1.0.0)) is a package that contains all SPI interfaces for third parties to interact with Microsoft Azure functions runtime.
0 commit comments