deployment-config-api
This module defines the public annotation and runtime API used by developers to create cloud functions with Cloudhopper.
It provides the key building blocks for function declaration, scheduling, and API gateway integration, independent of any specific cloud provider.
๐ก Purposeโ
The goal of this module is to allow application developers to define serverless functions in a clean, portable way using standard Java annotations and interfaces.
This module is used by developers, referenced by integrators, and consumed by the annotation processor.
๐ฆ Package Overviewโ
Package | Description |
---|---|
eu.cloudhopper.mc.annotations | Core annotations like @Function , @ScheduledTrigger , @HttpTrigger |
eu.cloudhopper.mc.runtime | Runtime interfaces such as CloudRequestHandler , HandlerContext |
๐งฉ Key Annotationsโ
@Function
โ
Defines a deployable cloud function.
@Function(name = "hello")
public class HelloFunction {
public String handleRequest(String input) {
return "Hello, " + input;
}
}
@ScheduledTrigger
โ
Optional trigger to invoke a function on a regular schedule.
@ScheduledTrigger(cron = "0 0 * * *")
@HttpTrigger
โ
Declares HTTP API metadata used to configure gateway routes.
@HttpTrigger(method = "GET", path = "/hello", summary = "Say hello")
๐งช Implementing a Handlerโ
All functions must implement CloudRequestHandler<I, O>
:
public interface CloudRequestHandler<I, O> {
O handleRequest(I input, HandlerContext context);
}
You will receive an implementation of HandlerContext
at runtime with request-specific metadata (e.g. request ID, region, etc.).
โ๏ธ Runtime Interfacesโ
These are the interfaces you implement or receive at runtime when writing Cloudhopper functions.
CloudRequestHandler<I, O>
โ
Defines the signature of a deployable cloud function.
public interface CloudRequestHandler<I, O> {
O handleRequest(I input, HandlerContext context);
}
You implement this interface to define the logic of your function. It receives:
input
: your deserialized request payloadcontext
: runtime metadata provided by the platform
HandlerContext
โ
Provides metadata about the current function invocation.
public interface HandlerContext {
String getRequestId();
String getFunctionName();
String getFunctionVersion();
String getInvokedFunctionArn();
String getLogGroupName();
String getLogStreamName();
long getRemainingTimeInMillis();
int getMemoryLimitInMB();
}
The platform adapter (e.g. AWS, Azure, GCP) supplies this to your function. It gives access to:
- invocation-specific IDs
- logging information
- timeout and memory limits
๐ Related Modulesโ
deployment-config-generator-api
: used by integrators to build custom code generatorsdeployment-config-processor
: uses this module to process annotations at compile time
๐ค Intended Audienceโ
This module is for:
- Application developers writing cloud functions
- Generator implementors referencing annotation types