Annotation Type WarmupTrigger


  • @Retention(RUNTIME)
    @Target(PARAMETER)
    public @interface WarmupTrigger

    The warmup trigger lets you define a function that's run when a new instance of your function app is started. You can use a warmup trigger to pre-load custom dependencies during the pre-warming process so your functions are ready to start processing requests immediately. Some actions for a warmup trigger might include opening connections, loading dependencies, or running any other custom logic before your app begins receiving traffic. The parameter type should be set as Object

    The following example shows a Java function that logs the message body of the event hub trigger:

    @FunctionName("Warmup")
     public void warmup(
        @WarmupTrigger Object warmupContext,
         final ExecutionContext context
     ) {
         context.getLogger().info("Function App instance is warm up");
     }
    Since:
    2.0.2
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      java.lang.String dataType
      Defines how Functions runtime should treat the parameter value.
      java.lang.String name
      The variable name used in function code for the request or request body.
    • Element Detail

      • name

        java.lang.String name
        The variable name used in function code for the request or request body.
        Returns:
        The variable name used in function code for the request or request body.
        Default:
        "warmupContext"
      • dataType

        java.lang.String dataType

        Defines how Functions runtime should treat the parameter value. Possible values are:

        • "": get the value as a string, and try to deserialize to actual parameter type like POJO
        • string: always get the value as a string
        • binary: get the value as a binary data, and try to deserialize to actual parameter type byte[]
        Returns:
        The dataType which will be used by the Functions runtime.
        Default:
        ""