Skip to content

Latest commit

 

History

History
24 lines (18 loc) · 2.53 KB

AOT-native-image.md

File metadata and controls

24 lines (18 loc) · 2.53 KB

Ahead Of Time (AOT) compilation

Ahead Of Time compilation build tools such as those provided by GraalVM's native-image require some configuration when using Temporal JavaSDK. Temporal JavaSDK uses Java proxies to provide Workflow and Activity stubs and the target classes of these proxies are application-specific. Proxy classes need to be generated at a build time by the current AOT tools. Temporal JavaSDK dependencies like gRPC and Protobuf use reflection and some of its target classes are sometimes not possible to determine in advance during the static analysis.

Temporal JavaSDK and Test Server support GraalVM native-image.

Temporal JavaSDK team does its best effort to maintain as complete native-image descriptors as technically possible for the following modules: temporal-sdk, temporal-testing, temporal-serviceclient, temporal-test-server. While these descriptors provide enough information for native-image to build and run a fully functional Temporal Test Server, any user building an application with Temporal JavaSDK will require an additional configuration for the reasons mentioned above: user interfaces are used by the JavaSDK for proxy creation, and they need to know in advance for native-image.

native-image build can be configured with respect to JNI, java proxying, reflection, etc by providing JSON configuration descriptors which helps native-image during building of the native execution file. This can be done manually, but it's labor-intensive and requires good understanding of native-image build process and configuration.

Instead, we recommend users run their JVM application along with the native-image Tracing agent. For example, the agent can be run with the full set of integration tests of the app to cover the largest variety of code paths. This agent will automatically generate additional descriptor files that users should place and retain with their project's source code under META-INF/native-image.