Class RestateHttpEndpointBuilder


  • public class RestateHttpEndpointBuilder
    extends java.lang.Object
    Endpoint builder for a Restate HTTP Endpoint using Vert.x, to serve Restate services.

    This endpoint supports the Restate HTTP/2 Streaming component Protocol.

    Example usage:

     public static void main(String[] args) {
       RestateHttpEndpointBuilder.builder()
               .bind(new Counter())
               .buildAndListen();
     }
     
    • Method Detail

      • withOptions

        public RestateHttpEndpointBuilder withOptions​(io.vertx.core.http.HttpServerOptions options)
        Add custom HttpServerOptions to the server used by the endpoint.
      • bind

        public RestateHttpEndpointBuilder bind​(java.lang.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 BindableService using bind(BindableService).

      • bind

        public <O> RestateHttpEndpointBuilder bind​(dev.restate.sdk.common.BindableService<O> service,
                                                   O options)
        Add a Restate bindable service to the endpoint, overriding the options.
      • withOpenTelemetry

        public RestateHttpEndpointBuilder withOpenTelemetry​(io.opentelemetry.api.OpenTelemetry openTelemetry)
        Add a OpenTelemetry implementation for tracing and metrics.
        See Also:
        OpenTelemetry
      • buildAndListen

        public void buildAndListen​(int port)
        Build and listen on the specified port.
      • buildAndListen

        public void buildAndListen()
        Build and listen on the port specified by the environment variable PORT, or alternatively on the default 9080 port.
      • build

        public io.vertx.core.http.HttpServer build()
        Build the HttpServer serving the Restate service endpoint.