Package eu.cloudhopper.mc.annotations
Annotation Interface Function
Marks a method as a deployable cloud function.
The annotated method is discovered during annotation processing, which
generates the provider-specific
CloudRequestHandler and the deployment
artifacts for it — you no longer implement that interface yourself.
Combine @Function with a trigger such as HttpTrigger or
ScheduledTrigger, and bind the method parameters with
RequestBody, PathParam, QueryParam or
HeaderParam.
Example:
@Function(name = "hello")
@HttpTrigger(method = "GET", path = "/hello/{name}")
public String hello(@PathParam("name") String name) {
return "Hello, " + name;
}
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classConstants representing the attribute names ofFunction. -
Required Element Summary
Required Elements -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionRegister extension attributes, for example vendor specific extensions or unsupported attributes you need for your generator.intThe maximum memory allocated to the function (in megabytes).intThe minimum number of instances to keep warm.intThe function timeout in seconds.
-
Element Details
-
name
String nameThe unique name of the function in the deployment target.- Returns:
- the function name
-
memory
int memoryThe maximum memory allocated to the function (in megabytes). Default is 128 MB.- Returns:
- the memory limit in MB
- Default:
128
-
timeout
int timeoutThe function timeout in seconds. Defines how long the function may run before being terminated. Default is 30 seconds.- Returns:
- timeout in seconds
- Default:
30
-
minInstances
int minInstancesThe minimum number of instances to keep warm. This enables pre-warming for reduced cold starts on some platforms. Default is 0.- Returns:
- minimum instance count
- Default:
0
-
extensions
Extension[] extensionsRegister extension attributes, for example vendor specific extensions or unsupported attributes you need for your generator.- Returns:
- the extension attributes, or an empty array if none
- Default:
{}
-