Full C++23 framework tree: runtime, observability, security, data, app, realtime, supervisor, clients, CLI, example plus enterprise tenancy, audit, operability, governance, supplychain. Postgres via docker compose for tests.
21 lines
733 B
C++
21 lines
733 B
C++
// Route: /pubsub/publish
|
|
#include "support/Assert.hpp"
|
|
|
|
using namespace molo::example::test;
|
|
|
|
int main() {
|
|
Fixture f;
|
|
int seen = 0;
|
|
f.services.pubsub->subscribe("news",
|
|
[&](const std::string&) { ++seen; });
|
|
auto pub = f.client->post("/pubsub/publish",
|
|
"{\"topic\":\"news\",\"message\":\"hi\"}",
|
|
"application/json");
|
|
check(pub.status == 200, "publish status 200");
|
|
check(contains(pub.body, "\"delivered\":1"), "one subscriber reached");
|
|
check(seen == 1, "side effect: listener ran");
|
|
auto hist = f.client->get("/pubsub/publish?topic=news");
|
|
check(contains(hist.body, "hi"), "history kept");
|
|
return finish("pubsub/publish");
|
|
}
|