Skip to content

Commit 5a27fa5

Browse files
Reintroduce RestateHttpEndpointBuilder to reduce breakage
1 parent 312c053 commit 5a27fa5

1 file changed

Lines changed: 121 additions & 0 deletions

File tree

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
// Copyright (c) 2023 - Restate Software, Inc., Restate GmbH
2+
//
3+
// This file is part of the Restate Java SDK,
4+
// which is released under the MIT license.
5+
//
6+
// You can find a copy of the license in file LICENSE in the root
7+
// directory of this repository or package, or at
8+
// https://github.com/restatedev/sdk-java/blob/main/LICENSE
9+
package dev.restate.sdk.http.vertx;
10+
11+
import dev.restate.sdk.endpoint.Endpoint;
12+
import dev.restate.sdk.endpoint.RequestIdentityVerifier;
13+
import dev.restate.sdk.endpoint.definition.ServiceDefinition;
14+
import io.opentelemetry.api.OpenTelemetry;
15+
import io.vertx.core.Vertx;
16+
import io.vertx.core.http.HttpServerOptions;
17+
import java.util.*;
18+
19+
/**
20+
* @deprecated Use {@link RestateHttpServer} in combination with {@link Endpoint} instead. This will
21+
* be removed in the next minor release.
22+
*/
23+
@Deprecated(since = "2.0", forRemoval = true)
24+
public class RestateHttpEndpointBuilder {
25+
26+
private HttpServerOptions options;
27+
private final Endpoint.Builder endpointBuilder;
28+
29+
private RestateHttpEndpointBuilder(Vertx vertx) {
30+
this.options = null;
31+
this.endpointBuilder = Endpoint.builder();
32+
}
33+
34+
/**
35+
* @deprecated Use {@link RestateHttpServer} in combination with {@link Endpoint} instead. This
36+
* will be removed in the next minor release.
37+
*/
38+
@Deprecated(since = "2.0", forRemoval = true)
39+
public static RestateHttpEndpointBuilder builder() {
40+
return new RestateHttpEndpointBuilder(Vertx.vertx());
41+
}
42+
43+
/**
44+
* @deprecated Use {@link RestateHttpServer} in combination with {@link Endpoint} instead. This
45+
* will be removed in the next minor release.
46+
*/
47+
@Deprecated(since = "2.0", forRemoval = true)
48+
public RestateHttpEndpointBuilder withOptions(HttpServerOptions options) {
49+
this.options = Objects.requireNonNull(options);
50+
return this;
51+
}
52+
53+
/**
54+
* @deprecated Use {@link RestateHttpServer} in combination with {@link Endpoint} instead. This
55+
* will be removed in the next minor release.
56+
*/
57+
@Deprecated(since = "2.0", forRemoval = true)
58+
public RestateHttpEndpointBuilder bind(Object service) {
59+
this.endpointBuilder.bind(service);
60+
return this;
61+
}
62+
63+
/**
64+
* @deprecated Use {@link RestateHttpServer} in combination with {@link Endpoint} instead. This
65+
* will be removed in the next minor release.
66+
*/
67+
@Deprecated(since = "2.0", forRemoval = true)
68+
public RestateHttpEndpointBuilder bind(ServiceDefinition serviceDefinition) {
69+
this.endpointBuilder.bind(serviceDefinition);
70+
return this;
71+
}
72+
73+
/**
74+
* @deprecated Use {@link RestateHttpServer} in combination with {@link Endpoint} instead. This
75+
* will be removed in the next minor release.
76+
*/
77+
@Deprecated(since = "2.0", forRemoval = true)
78+
public RestateHttpEndpointBuilder withOpenTelemetry(OpenTelemetry openTelemetry) {
79+
this.endpointBuilder.withOpenTelemetry(openTelemetry);
80+
return this;
81+
}
82+
83+
/**
84+
* @deprecated Use {@link RestateHttpServer} in combination with {@link Endpoint} instead. This
85+
* will be removed in the next minor release.
86+
*/
87+
@Deprecated(since = "2.0", forRemoval = true)
88+
public RestateHttpEndpointBuilder withRequestIdentityVerifier(
89+
RequestIdentityVerifier requestIdentityVerifier) {
90+
this.endpointBuilder.withRequestIdentityVerifier(requestIdentityVerifier);
91+
return this;
92+
}
93+
94+
/**
95+
* @deprecated Use {@link RestateHttpServer} in combination with {@link Endpoint} instead. This
96+
* will be removed in the next minor release.
97+
*/
98+
@Deprecated(since = "2.0", forRemoval = true)
99+
public RestateHttpEndpointBuilder enablePreviewContext() {
100+
this.endpointBuilder.enablePreviewContext();
101+
return this;
102+
}
103+
104+
/**
105+
* @deprecated Use {@link RestateHttpServer} in combination with {@link Endpoint} instead. This
106+
* will be removed in the next minor release.
107+
*/
108+
@Deprecated(since = "2.0", forRemoval = true)
109+
public int buildAndListen(int port) {
110+
return RestateHttpServer.listen(endpointBuilder, port);
111+
}
112+
113+
/**
114+
* @deprecated Use {@link RestateHttpServer} in combination with {@link Endpoint} instead. This
115+
* will be removed in the next minor release.
116+
*/
117+
@Deprecated(since = "2.0", forRemoval = true)
118+
public int buildAndListen() {
119+
return RestateHttpServer.listen(endpointBuilder);
120+
}
121+
}

0 commit comments

Comments
 (0)