Skip to main content

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โ€‹

PackageDescription
eu.cloudhopper.mc.annotationsCore annotations like @Function, @ScheduledTrigger, @HttpTrigger
eu.cloudhopper.mc.runtimeRuntime 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 payload
  • context: 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

  • deployment-config-generator-api: used by integrators to build custom code generators
  • deployment-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