|
13 | 13 | import dev.restate.sdk.annotation.Service; |
14 | 14 | import dev.restate.sdk.endpoint.Endpoint; |
15 | 15 | import dev.restate.sdk.http.vertx.RestateHttpServer; |
16 | | -import io.vertx.core.AbstractVerticle; |
17 | | -import io.vertx.core.Promise; |
18 | | -import io.vertx.core.Vertx; |
19 | | -import io.vertx.core.VertxOptions; |
20 | | -import io.vertx.core.http.Http2Settings; |
21 | | -import io.vertx.core.http.HttpServerOptions; |
22 | 16 | import java.time.Duration; |
23 | 17 | import org.apache.logging.log4j.LogManager; |
24 | 18 | import org.apache.logging.log4j.Logger; |
@@ -46,29 +40,6 @@ public GreetingResponse greet(Greeting req) { |
46 | 40 | } |
47 | 41 |
|
48 | 42 | public static void main(String[] args) { |
49 | | - var vertxOptions = new VertxOptions(); |
50 | | - var eventLoopPoolSize = vertxOptions.getEventLoopPoolSize(); |
51 | | - var vertx = Vertx.vertx(new VertxOptions()); |
52 | | - var httpServerOptions = |
53 | | - new HttpServerOptions().setInitialSettings(new Http2Settings().setMaxConcurrentStreams(10)); |
54 | | - |
55 | | - var endpoint = Endpoint.bind(new Greeter()).bind(new Counter()).build(); |
56 | | - |
57 | | - for (int i = 0; i < eventLoopPoolSize; i++) { |
58 | | - vertx.deployVerticle( |
59 | | - new AbstractVerticle() { |
60 | | - @Override |
61 | | - public void start(Promise<Void> startPromise) { |
62 | | - RestateHttpServer.fromEndpoint(vertx, endpoint, httpServerOptions) |
63 | | - .listen(9080) |
64 | | - .map( |
65 | | - server -> { |
66 | | - LOG.info("Server started on port {}", server.actualPort()); |
67 | | - return (Void) null; |
68 | | - }) |
69 | | - .andThen(startPromise); |
70 | | - } |
71 | | - }); |
72 | | - } |
| 43 | + RestateHttpServer.listen(Endpoint.bind(new Greeter()).bind(new Counter())); |
73 | 44 | } |
74 | 45 | } |
0 commit comments