DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
ProtoBufStream.cpp
Go to the documentation of this file.
1
9#include "ProtoBufStream.hpp"
10#include <ers/StreamFactory.hpp>
11#include <string>
12#include <iostream>
13#include <chrono>
14#include <boost/crc.hpp>
15#include <vector>
16
18
19
22namespace erskafka
23{
25 : m_session("Uknown")
26 , m_application("Uknown") {
27
28 nlohmann::json conf;
29 conf["bootstrap"] = param;
30
31 m_publisher = std::make_unique<dunedaq::erskafka::ERSPublisher>(conf);
32
33 if(auto env_p = std::getenv("DUNEDAQ_SESSION"))
34 m_session = env_p;
35
36 if (auto app_p = std::getenv("DUNEDAQ_APPLICATION_NAME"))
37 m_application = app_p;
38 }
39
40
45 {
46 try {
47
48 auto schema = to_schema_chain(issue);
49 schema.set_session(m_session);
50 schema.set_application(m_application);
51 m_publisher -> publish(std::move(schema)) ;
52
53 }
54 catch(const std::exception& e)
55 {
56 std::cerr << "Producer error : " << e.what() << '\n';
57 }
58 }
59} // namespace erskafka
Base class for any user define issue.
Definition Issue.hpp:69
ERS stream implementation.
ProtoBufStream(const std::string &param)
std::unique_ptr< dunedaq::erskafka::ERSPublisher > m_publisher
void write(const ers::Issue &issue) override
#define ERS_REGISTER_OUTPUT_STREAM(class, name, param)
Definition macro.hpp:16