Table of Contents

Class RestateLambdaHandler

Namespace
Restate.Sdk
Assembly
Restate.Sdk.Lambda.dll

Base class for Restate Lambda handlers. Subclass and override Register() to bind your services, then reference this as your Lambda function handler.

public abstract class RestateLambdaHandler
Inheritance
RestateLambdaHandler
Inherited Members

Examples

public class Handler : RestateLambdaHandler
{
    public override void Register()
    {
        Bind<GreeterService>();
    }
}

Constructors

RestateLambdaHandler()

Initializes the Lambda handler, building the service registry from registered services.

protected RestateLambdaHandler()

Methods

Bind<TService>()

Registers a Restate service type. Call from Register().

protected void Bind<TService>() where TService : class

Type Parameters

TService

ConfigureTelemetry(Action<RestateTelemetryOptions>)

Configures the SDK's tracing and metrics instrumentation (the Restate.Sdk ActivitySource and Meter). Call from Register().

protected void ConfigureTelemetry(Action<RestateTelemetryOptions> configure)

Parameters

configure Action<RestateTelemetryOptions>

Callback mutating the telemetry options.

Exceptions

ArgumentNullException

configure is null.

InvalidOperationException

Thrown when called after handler construction (e.g. from a derived-class constructor body, which runs after Register()) — the invocation pipeline has already been built and late changes would be silently ignored.

FunctionHandler(APIGatewayProxyRequest, ILambdaContext)

Lambda function handler entry point. Processes Restate discovery and invocation requests.

public Task<APIGatewayProxyResponse> FunctionHandler(APIGatewayProxyRequest request, ILambdaContext context)

Parameters

request APIGatewayProxyRequest
context ILambdaContext

Returns

Task<APIGatewayProxyResponse>

Register()

Override this method to register your Restate service types using Bind<TService>().

public abstract void Register()

UseLoggerFactory(ILoggerFactory)

Configures the logger factory used for SDK logging and Logger. Call from Register(). When not configured, logging is disabled.

protected void UseLoggerFactory(ILoggerFactory loggerFactory)

Parameters

loggerFactory ILoggerFactory

Exceptions

InvalidOperationException

Thrown when called after handler construction (e.g. from a derived-class constructor body, which runs after Register()) — the invocation pipeline has already been built and a late factory would be silently ignored.

WithIdentityKeys(params string[])

Configures Restate identity public keys (publickeyv1_<base58>) used to verify that incoming requests originate from a trusted Restate instance. Call from Register(). When at least one key is configured, every request must carry a valid x-restate-signature-scheme: v1 signature; requests that fail verification are rejected with 401 Unauthorized. When no keys are configured, requests are not verified.

protected void WithIdentityKeys(params string[] keys)

Parameters

keys string[]

The serialized identity keys, as printed by restate-server on startup.

Exceptions

ArgumentNullException

keys is null.

ArgumentException

keys is empty (which would silently leave verification disabled), or a key is malformed (wrong prefix, invalid base58, or wrong decoded length).

InvalidOperationException

Thrown when called after handler construction (e.g. from a derived-class constructor body, which runs after Register()) — the identity verifier has already been built and late keys would be silently ignored, leaving the endpoint unverified.