Package dev.restate.sdk.http.vertx
Class RestateHttpServer
java.lang.Object
dev.restate.sdk.http.vertx.RestateHttpServer
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 -
Method Summary
Modifier and TypeMethodDescriptionstatic io.vertx.core.http.HttpServer
fromEndpoint
(Endpoint endpoint) Create a Vert.xHttpServer
from the provided endpoint.static io.vertx.core.http.HttpServer
fromEndpoint
(Endpoint.Builder endpointBuilder) static io.vertx.core.http.HttpServer
fromEndpoint
(Endpoint.Builder endpointBuilder, io.vertx.core.http.HttpServerOptions options) static io.vertx.core.http.HttpServer
fromEndpoint
(Endpoint endpoint, io.vertx.core.http.HttpServerOptions options) Create a Vert.xHttpServer
from the provided endpoint, with the givenHttpServerOptions
.static io.vertx.core.http.HttpServer
fromEndpoint
(io.vertx.core.Vertx vertx, Endpoint endpoint) Create a Vert.xHttpServer
from the provided endpoint.static io.vertx.core.http.HttpServer
fromEndpoint
(io.vertx.core.Vertx vertx, Endpoint.Builder endpointBuilder) static io.vertx.core.http.HttpServer
fromEndpoint
(io.vertx.core.Vertx vertx, Endpoint.Builder endpointBuilder, io.vertx.core.http.HttpServerOptions options) static io.vertx.core.http.HttpServer
fromEndpoint
(io.vertx.core.Vertx vertx, Endpoint endpoint, io.vertx.core.http.HttpServerOptions options) Create a Vert.xHttpServer
from the provided endpoint, with the givenHttpServerOptions
.static io.vertx.core.http.HttpServer
fromHandler
(HttpEndpointRequestHandler handler) Create a Vert.xHttpServer
from the providedHttpEndpointRequestHandler
.static io.vertx.core.http.HttpServer
fromHandler
(HttpEndpointRequestHandler handler, io.vertx.core.http.HttpServerOptions options) Create a Vert.xHttpServer
from the providedHttpEndpointRequestHandler
, with the givenHttpServerOptions
.static io.vertx.core.http.HttpServer
fromHandler
(io.vertx.core.Vertx vertx, HttpEndpointRequestHandler handler) Create a Vert.xHttpServer
from the providedHttpEndpointRequestHandler
.static io.vertx.core.http.HttpServer
fromHandler
(io.vertx.core.Vertx vertx, HttpEndpointRequestHandler handler, io.vertx.core.http.HttpServerOptions options) Create a Vert.xHttpServer
from the providedHttpEndpointRequestHandler
, with the givenHttpServerOptions
.static int
Start serving the providedendpoint
on the port specified by the environment variablePORT
, or alternatively on the default9080
port.static int
listen
(Endpoint.Builder endpointBuilder) Likelisten(Endpoint)
static int
listen
(Endpoint.Builder endpointBuilder, int port) static int
Start serving the providedendpoint
on the specified port.static int
listen
(HttpEndpointRequestHandler requestHandler) Likelisten(Endpoint)
, with an already built request handlerstatic int
listen
(HttpEndpointRequestHandler requestHandler, int port) Likelisten(Endpoint, int)
, with an already built request handler
-
Constructor Details
-
RestateHttpServer
public RestateHttpServer()
-
-
Method Details
-
listen
Start serving the providedendpoint
on the port specified by the environment variablePORT
, or alternatively on the default9080
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
Likelisten(Endpoint)
-
listen
Start serving the providedendpoint
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
-
listen
Likelisten(Endpoint)
, with an already built request handler -
listen
Likelisten(Endpoint, int)
, with an already built request handler -
fromEndpoint
Create a Vert.xHttpServer
from the provided endpoint. -
fromEndpoint
-
fromEndpoint
public static io.vertx.core.http.HttpServer fromEndpoint(Endpoint endpoint, io.vertx.core.http.HttpServerOptions options) Create a Vert.xHttpServer
from the provided endpoint, with the givenHttpServerOptions
. -
fromEndpoint
public static io.vertx.core.http.HttpServer fromEndpoint(Endpoint.Builder endpointBuilder, io.vertx.core.http.HttpServerOptions options) -
fromEndpoint
public static io.vertx.core.http.HttpServer fromEndpoint(io.vertx.core.Vertx vertx, Endpoint endpoint) Create a Vert.xHttpServer
from the provided endpoint. -
fromEndpoint
public static io.vertx.core.http.HttpServer fromEndpoint(io.vertx.core.Vertx vertx, Endpoint.Builder endpointBuilder) -
fromEndpoint
public static io.vertx.core.http.HttpServer fromEndpoint(io.vertx.core.Vertx vertx, Endpoint endpoint, io.vertx.core.http.HttpServerOptions options) Create a Vert.xHttpServer
from the provided endpoint, with the givenHttpServerOptions
. -
fromEndpoint
public static io.vertx.core.http.HttpServer fromEndpoint(io.vertx.core.Vertx vertx, Endpoint.Builder endpointBuilder, io.vertx.core.http.HttpServerOptions options) -
fromHandler
Create a Vert.xHttpServer
from the providedHttpEndpointRequestHandler
. -
fromHandler
public static io.vertx.core.http.HttpServer fromHandler(HttpEndpointRequestHandler handler, io.vertx.core.http.HttpServerOptions options) Create a Vert.xHttpServer
from the providedHttpEndpointRequestHandler
, with the givenHttpServerOptions
. -
fromHandler
public static io.vertx.core.http.HttpServer fromHandler(io.vertx.core.Vertx vertx, HttpEndpointRequestHandler handler) Create a Vert.xHttpServer
from the providedHttpEndpointRequestHandler
. -
fromHandler
public static io.vertx.core.http.HttpServer fromHandler(io.vertx.core.Vertx vertx, HttpEndpointRequestHandler handler, io.vertx.core.http.HttpServerOptions options) Create a Vert.xHttpServer
from the providedHttpEndpointRequestHandler
, with the givenHttpServerOptions
.
-