Skip to content

Commit 5a39026

Browse files
authored
[OMON-566] Add run type to Kafka HTTP server (#289)
1 parent ac2e397 commit 5a39026

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

examples/8-KafkaToHttpServer.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ void httpServer(tcp::acceptor& acceptor, tcp::socket& socket) {
158158
});
159159
connection->addCallback("active_runs+WHERE+run",
160160
[](http::request<http::dynamic_body>& request, http::response<http::dynamic_body>& response) {
161-
std::string jsonPrefix = R"({"results":[{"statement_id":0,"series":[{"name":"env","columns":["time","Env ID","Run number","Detectors","State"],"values":[)";
161+
std::string jsonPrefix = R"({"results":[{"statement_id":0,"series":[{"name":"env","columns":["time","Env ID","Run number","Detectors","State", "Run type"],"values":[)";
162162
std::string jsonSuffix = R"(]}]}]})";
163163
response.set(http::field::content_type, "application/json");
164164
std::string runString = std::string(request.target().substr(request.target().find("WHERE+run+%3D+") + 14));
@@ -181,7 +181,8 @@ void httpServer(tcp::acceptor& acceptor, tcp::socket& socket) {
181181
+ gActiveEnvs.activeruns(i).environmentid() + "\", "
182182
+ std::to_string(gActiveEnvs.activeruns(i).runnumber()) + ", \""
183183
+ boost::algorithm::join(detectors, " ") + "\", \""
184-
+ gActiveEnvs.activeruns(i).state() + "\"]";
184+
+ gActiveEnvs.activeruns(i).state() + "\", \""
185+
+ gActiveEnvs.activeruns(i).runtype() + "\"]";
185186
}
186187
beast::ostream(response.body()) << jsonPrefix << envsJson << jsonSuffix << '\n';
187188
});

0 commit comments

Comments
 (0)