com.microsoft.durabletask.azurefunctions.DurableActivityTrigger Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of durabletask-azure-functions Show documentation
Show all versions of durabletask-azure-functions Show documentation
This package contains classes, interfaces, and annotations for developing with Azure Durable Functions in Java.
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*/
package com.microsoft.durabletask.azurefunctions;
import com.microsoft.azure.functions.annotation.CustomBinding;
import com.microsoft.azure.functions.annotation.HasImplicitOutput;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
*
* Azure Functions attribute for binding a function parameter to a Durable Task activity input.
*
* The following is an example of an activity trigger function that accepts a String input and returns a String output.
*
*
* {@literal @}FunctionName("SayHello")
* public String sayHello(
* {@literal @}DurableActivityTrigger(name = "name") String name,
* final ExecutionContext context) {
* context.getLogger().info("Saying hello to: " + name);
* return String.format("Hello %s!", name);
* }
*
*
* @since 2.0.0
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER)
@CustomBinding(direction = "in", name = "", type = "activityTrigger")
@HasImplicitOutput
public @interface DurableActivityTrigger {
/**
* The name of the activity function.
* If not specified, the function name is used as the name of the activity.
* This property supports binding parameters.
*
* @return The name of the orchestrator function.
*/
String activity() default "";
/**
* The variable name used in function.json.
*
* @return The variable name used in function.json.
*/
String name();
/**
*
* 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[]
*
*
* @return The dataType which will be used by the Functions runtime.
*/
String dataType() default "";
}