Line data Source code
1 :
2 : /* This application creates a ERSPublisher and dumps regular messages via the system
3 :
4 : */
5 :
6 : #include <chrono>
7 : #include <sstream>
8 : #include <thread>
9 :
10 : #include <ers/ers.hpp>
11 : #include <erskafka/ERSPublisher.hpp>
12 :
13 : using namespace std;
14 : using namespace dunedaq::erskafka;
15 :
16 0 : ERS_DECLARE_ISSUE(erstest, TestIssue, "this is issue with ID: " << id, ((int)id))
17 :
18 : int
19 0 : main(int argc, char* argv[])
20 : {
21 :
22 0 : nlohmann::json conf;
23 0 : conf["bootstrap"] = "monkafka.cern.ch:30092";
24 :
25 0 : ERSPublisher p(conf);
26 :
27 : int n = 20;
28 0 : for (int i = 0; i < n; ++i) {
29 0 : erstest::TestIssue issue(ERS_HERE, i);
30 0 : p.publish(to_schema_chain(issue));
31 0 : this_thread::sleep_for(std::chrono::milliseconds(500));
32 0 : }
33 :
34 0 : return 0;
35 0 : }
|