dev.restate.sdk.lambda.RestateLambdaEndpointBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sdk-lambda Show documentation
Show all versions of sdk-lambda Show documentation
Restate SDK AWS Lambda integration
The newest version!
// Copyright (c) 2023 - Restate Software, Inc., Restate GmbH
//
// This file is part of the Restate Java SDK,
// which is released under the MIT license.
//
// You can find a copy of the license in file LICENSE in the root
// directory of this repository or package, or at
// https://github.com/restatedev/sdk-java/blob/main/LICENSE
package dev.restate.sdk.lambda;
import dev.restate.sdk.auth.RequestIdentityVerifier;
import dev.restate.sdk.common.syscalls.ServiceDefinition;
import dev.restate.sdk.core.RestateEndpoint;
import dev.restate.sdk.core.manifest.EndpointManifestSchema;
import io.opentelemetry.api.OpenTelemetry;
/** Endpoint builder for a Restate AWS Lambda Endpoint, to serve Restate service. */
public final class RestateLambdaEndpointBuilder {
private final RestateEndpoint.Builder restateEndpoint =
RestateEndpoint.newBuilder(EndpointManifestSchema.ProtocolMode.REQUEST_RESPONSE);
private OpenTelemetry openTelemetry = OpenTelemetry.noop();
/**
* Add a Restate service to the endpoint. This will automatically discover the generated factory
* based on the class name.
*
* You can also manually instantiate the {@link ServiceDefinition} using {@link
* #bind(ServiceDefinition)}.
*/
public RestateLambdaEndpointBuilder bind(Object service) {
return this.bind(RestateEndpoint.discoverServiceDefinitionFactory(service).create(service));
}
/**
* Add a Restate service to the endpoint.
*
*
To set the options, use {@link #bind(ServiceDefinition, Object)}.
*/
public RestateLambdaEndpointBuilder bind(ServiceDefinition> service) {
//noinspection unchecked
this.restateEndpoint.bind((ServiceDefinition