@@ -45,6 +45,7 @@ class RequestHttpServerHandler implements Handler<HttpServerRequest> {
4545 private static final Pattern SLASH = Pattern .compile (Pattern .quote ("/" ));
4646
4747 private static final String DISCOVER_PATH = "/discover" ;
48+ private static final String HEALTH_PATH = "/health" ;
4849
4950 static final TextMapGetter <MultiMap > OTEL_TEXT_MAP_GETTER =
5051 new TextMapGetter <>() {
@@ -75,7 +76,13 @@ public String get(@Nullable MultiMap carrier, String key) {
7576 public void handle (HttpServerRequest request ) {
7677 URI uri = URI .create (request .uri ());
7778
78- // Let's first check if it's a discovery request
79+ // health check
80+ if (HEALTH_PATH .equalsIgnoreCase (uri .getPath ())) {
81+ this .handleHealthRequest (request );
82+ return ;
83+ }
84+
85+ // Discovery request
7986 if (DISCOVER_PATH .equalsIgnoreCase (uri .getPath ())) {
8087 this .handleDiscoveryRequest (request );
8188 return ;
@@ -85,7 +92,7 @@ public void handle(HttpServerRequest request) {
8592 String [] pathSegments = SLASH .split (uri .getPath ());
8693 if (pathSegments .length < 3 ) {
8794 LOG .warn (
88- "Path doesn't match the pattern /invoke/ServiceName/HandlerName nor /discover: '{}'" ,
95+ "Path doesn't match the pattern /invoke/ServiceName/HandlerName nor /discover nor /health : '{}'" ,
8996 request .path ());
9097 request .response ().setStatusCode (NOT_FOUND .code ()).end ();
9198 return ;
@@ -172,4 +179,12 @@ private void handleDiscoveryRequest(HttpServerRequest request) {
172179 .putHeader (CONTENT_TYPE , discoveryResponse .getContentType ())
173180 .end (Buffer .buffer (discoveryResponse .getSerializedManifest ()));
174181 }
182+
183+ private void handleHealthRequest (HttpServerRequest request ) {
184+ request
185+ .response ()
186+ .setStatusCode (OK .code ())
187+ .putHeader (X_RESTATE_SERVER_KEY , X_RESTATE_SERVER_VALUE )
188+ .end ();
189+ }
175190}
0 commit comments