15 #ifndef FAIRMQPROCESSOR_H_
16 #define FAIRMQPROCESSOR_H_
20 #include <FairMQDevice.h>
21 #include <FairMQLogger.h>
23 template<
typename Task>
28 : fProcessorTask(new Task)
29 , fInChannelName(
"data1")
30 , fOutChannelName(
"data2")
44 std::string inChannelName = fConfig->GetValue<std::string>(
"in-channel");
45 std::string outChannelName = fConfig->GetValue<std::string>(
"out-channel");
47 if (inChannelName !=
"") {
48 fInChannelName = inChannelName;
50 if (outChannelName !=
"") {
51 fOutChannelName = outChannelName;
54 fProcessorTask->InitTask();
55 OnData(fInChannelName, [
this](FairMQMessagePtr& msg,
int ) {
57 fProcessorTask->SetPayload(msg);
58 fProcessorTask->Exec();
59 fProcessorTask->GetPayload(msg);
61 Send(msg, fOutChannelName);
68 virtual void PostRun() { LOG(info) <<
"Received " << fReceivedMsgs <<
" and sent " << fSentMsgs <<
" messages!"; }
71 std::unique_ptr<FairMQProcessorTask> fProcessorTask;
72 std::string fInChannelName;
73 std::string fOutChannelName;
virtual ~FairMQProcessor()
FairMQProcessor operator=(const FairMQProcessor &)=delete