Class RestateHttpServer

java.lang.Object
dev.restate.sdk.http.vertx.RestateHttpServer

public class RestateHttpServer extends 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) {
   Endpoint endpoint = Endpoint.builder()
     .bind(new Counter())
     .build();

   RestateHttpServer.listen(endpoint);
 }
 
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static io.vertx.core.http.HttpServer
    fromEndpoint(dev.restate.sdk.endpoint.Endpoint endpoint)
    Create a Vert.x HttpServer from the provided endpoint.
    static io.vertx.core.http.HttpServer
    fromEndpoint(dev.restate.sdk.endpoint.Endpoint.Builder endpointBuilder)
    static io.vertx.core.http.HttpServer
    fromEndpoint(dev.restate.sdk.endpoint.Endpoint.Builder endpointBuilder, io.vertx.core.http.HttpServerOptions options)
    static io.vertx.core.http.HttpServer
    fromEndpoint(dev.restate.sdk.endpoint.Endpoint endpoint, io.vertx.core.http.HttpServerOptions options)
    Create a Vert.x HttpServer from the provided endpoint, with the given HttpServerOptions.
    static io.vertx.core.http.HttpServer
    fromEndpoint(io.vertx.core.Vertx vertx, dev.restate.sdk.endpoint.Endpoint endpoint)
    Create a Vert.x HttpServer from the provided endpoint.
    static io.vertx.core.http.HttpServer
    fromEndpoint(io.vertx.core.Vertx vertx, dev.restate.sdk.endpoint.Endpoint.Builder endpointBuilder)
    static io.vertx.core.http.HttpServer
    fromEndpoint(io.vertx.core.Vertx vertx, dev.restate.sdk.endpoint.Endpoint.Builder endpointBuilder, io.vertx.core.http.HttpServerOptions options)
    static io.vertx.core.http.HttpServer
    fromEndpoint(io.vertx.core.Vertx vertx, dev.restate.sdk.endpoint.Endpoint endpoint, io.vertx.core.http.HttpServerOptions options)
    Create a Vert.x HttpServer from the provided endpoint, with the given HttpServerOptions.
    static int
    listen(dev.restate.sdk.endpoint.Endpoint endpoint)
    Start serving the provided endpoint on the port specified by the environment variable PORT, or alternatively on the default 9080 port.
    static int
    listen(dev.restate.sdk.endpoint.Endpoint.Builder endpointBuilder)
    static int
    listen(dev.restate.sdk.endpoint.Endpoint.Builder endpointBuilder, int port)
    static int
    listen(dev.restate.sdk.endpoint.Endpoint endpoint, int port)
    Start serving the provided endpoint on the specified port.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RestateHttpServer

      public RestateHttpServer()
  • Method Details

    • listen

      public static int listen(dev.restate.sdk.endpoint.Endpoint endpoint)
      Start serving the provided endpoint on the port specified by the environment variable PORT, or alternatively on the default 9080 port.

      NOTE: this method will block for opening the socket and reserving the port. If you need a non-blocking variant, manually create the server with fromEndpoint(Endpoint) and start listening it.

      Returns:
      The listening port
    • listen

      public static int listen(dev.restate.sdk.endpoint.Endpoint.Builder endpointBuilder)
    • listen

      public static int listen(dev.restate.sdk.endpoint.Endpoint endpoint, int port)
      Start serving the provided endpoint on the specified port.

      NOTE: this method will block for opening the socket and reserving the port. If you need a non-blocking variant, manually create the server with fromEndpoint(Endpoint) and start listening it.

      Returns:
      The listening port
    • listen

      public static int listen(dev.restate.sdk.endpoint.Endpoint.Builder endpointBuilder, int port)
    • fromEndpoint

      public static io.vertx.core.http.HttpServer fromEndpoint(dev.restate.sdk.endpoint.Endpoint endpoint)
      Create a Vert.x HttpServer from the provided endpoint.
    • fromEndpoint

      public static io.vertx.core.http.HttpServer fromEndpoint(dev.restate.sdk.endpoint.Endpoint.Builder endpointBuilder)
    • fromEndpoint

      public static io.vertx.core.http.HttpServer fromEndpoint(dev.restate.sdk.endpoint.Endpoint endpoint, io.vertx.core.http.HttpServerOptions options)
      Create a Vert.x HttpServer from the provided endpoint, with the given HttpServerOptions.
    • fromEndpoint

      public static io.vertx.core.http.HttpServer fromEndpoint(dev.restate.sdk.endpoint.Endpoint.Builder endpointBuilder, io.vertx.core.http.HttpServerOptions options)
    • fromEndpoint

      public static io.vertx.core.http.HttpServer fromEndpoint(io.vertx.core.Vertx vertx, dev.restate.sdk.endpoint.Endpoint endpoint)
      Create a Vert.x HttpServer from the provided endpoint.
    • fromEndpoint

      public static io.vertx.core.http.HttpServer fromEndpoint(io.vertx.core.Vertx vertx, dev.restate.sdk.endpoint.Endpoint.Builder endpointBuilder)
    • fromEndpoint

      public static io.vertx.core.http.HttpServer fromEndpoint(io.vertx.core.Vertx vertx, dev.restate.sdk.endpoint.Endpoint endpoint, io.vertx.core.http.HttpServerOptions options)
      Create a Vert.x HttpServer from the provided endpoint, with the given HttpServerOptions.
    • fromEndpoint

      public static io.vertx.core.http.HttpServer fromEndpoint(io.vertx.core.Vertx vertx, dev.restate.sdk.endpoint.Endpoint.Builder endpointBuilder, io.vertx.core.http.HttpServerOptions options)