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 <thread>
8 : #include <sstream>
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,
17 : TestIssue,
18 : "this is issue with ID: " << id,
19 : ((int)id)
20 : )
21 :
22 0 : int main( int argc, char * argv[] ) {
23 :
24 0 : nlohmann::json conf;
25 0 : conf["bootstrap"] = "monkafka.cern.ch:30092";
26 :
27 0 : ERSPublisher p(conf);
28 :
29 : int n = 20 ;
30 0 : for ( int i = 0 ; i < n ; ++i ) {
31 0 : erstest::TestIssue issue(ERS_HERE, i);
32 0 : p.publish( to_schema_chain(issue) );
33 0 : this_thread::sleep_for(std::chrono::milliseconds(500));
34 0 : }
35 :
36 :
37 0 : return 0 ;
38 0 : }
|