Class Endpoint.Builder

java.lang.Object
dev.restate.sdk.endpoint.Endpoint.Builder
Enclosing class:
Endpoint

public static class Endpoint.Builder extends Object
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • bind

      public Endpoint.Builder bind(Object service)
      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 ServiceDefinition using bind(ServiceDefinition).

    • bind

      public Endpoint.Builder bind(Object service, HandlerRunner.Options options)
      Like bind(Object), but allows to provide options for the handler runner. This allows to configure for the Java API the executor where to run the handler code, or the Kotlin API the coroutine context.

      Look at the respective documentations of the HandlerRunner class in the Java or in the Kotlin module.

      See Also:
    • bind

      public Endpoint.Builder bind(ServiceDefinition serviceDefinition)
      Add a manual ServiceDefinition to the endpoint.
    • withOpenTelemetry

      public Endpoint.Builder withOpenTelemetry(io.opentelemetry.api.OpenTelemetry openTelemetry)
      Set the OpenTelemetry implementation for tracing and metrics.
      See Also:
      • OpenTelemetry
    • setOpenTelemetry

      public void setOpenTelemetry(io.opentelemetry.api.OpenTelemetry openTelemetry)
    • getOpenTelemetry

      public io.opentelemetry.api.OpenTelemetry getOpenTelemetry()
      Returns:
      the configured OpenTelemetry
    • withRequestIdentityVerifier

      public Endpoint.Builder withRequestIdentityVerifier(RequestIdentityVerifier requestIdentityVerifier)
      Set the request identity verifier for this endpoint.

      For the Restate implementation to use with Restate Cloud, check the module sdk-request-identity.

    • setRequestIdentityVerifier

      public void setRequestIdentityVerifier(RequestIdentityVerifier requestIdentityVerifier)
    • getRequestIdentityVerifier

      public RequestIdentityVerifier getRequestIdentityVerifier()
      Returns:
      the configured request identity verifier
    • enablePreviewContext

      public Endpoint.Builder enablePreviewContext()
    • build

      public Endpoint build()