@@ -881,6 +881,35 @@ class adhoc_query_handler : public StoppableHandler {
881881#endif
882882};
883883
884+ class service_status_handler : public seastar ::httpd::handler_base {
885+ public:
886+ service_status_handler () {}
887+ ~service_status_handler () override = default ;
888+
889+ seastar::future<std::unique_ptr<seastar::httpd::reply>> handle (
890+ const seastar::sstring& path,
891+ std::unique_ptr<seastar::httpd::request> req,
892+ std::unique_ptr<seastar::httpd::reply> rep) override {
893+ if (req->_method == " GET" ) {
894+ if (path.find (" ready" ) != seastar::sstring::npos) {
895+ auto & graph_db_service = GraphDBService::get ();
896+ rep->set_content_type (" application/json" );
897+ if (graph_db_service.is_actors_running ()) {
898+ return new_reply (std::move (rep),
899+ seastar::httpd::reply::status_type::ok,
900+ " Service Is Ready" );
901+ } else {
902+ return new_reply (
903+ std::move (rep),
904+ seastar::httpd::reply::status_type::service_unavailable,
905+ " Service Is Not Ready" );
906+ }
907+ }
908+ }
909+ return new_bad_request_reply (std::move (rep), " Unsupported action" );
910+ }
911+ };
912+
884913// /////////////////////////graph_db_http_handler/////////////////////////////
885914
886915graph_db_http_handler::graph_db_http_handler (uint16_t http_port,
@@ -1081,6 +1110,10 @@ seastar::future<> graph_db_http_handler::set_routes() {
10811110 r.add (match_rule, OPERATIONS[i]);
10821111 }
10831112
1113+ r.add (seastar::httpd::operation_type::GET,
1114+ seastar::httpd::url (" /v1/service/ready" ),
1115+ new service_status_handler ());
1116+
10841117 return seastar::make_ready_future<>();
10851118 });
10861119}
0 commit comments