FairMQ
1.4.33
C++ Message Queuing Library and Framework
|
15 #ifndef FAIRMQMERGER_H_
16 #define FAIRMQMERGER_H_
18 #include "FairMQDevice.h"
19 #include "../FairMQPoller.h"
20 #include "../FairMQLogger.h"
30 , fInChannelName(
"data-in")
31 , fOutChannelName(
"data-out")
37 std::string fInChannelName;
38 std::string fOutChannelName;
47 void RegisterChannelEndpoints()
override
49 RegisterChannelEndpoint(fInChannelName, 1, 10000);
50 RegisterChannelEndpoint(fOutChannelName, 1, 1);
52 PrintRegisteredChannels();
57 int numInputs =
fChannels.at(fInChannelName).size();
59 std::vector<FairMQChannel*> chans;
62 chans.push_back(&chan);
65 FairMQPollerPtr poller(NewPoller(chans));
72 for (
int i = 0; i < numInputs; ++i) {
74 if (poller->CheckInput(i)) {
77 if (
Receive(payload, fInChannelName, i) >= 0) {
78 if (
Send(payload, fOutChannelName) < 0) {
79 LOG(debug) <<
"Transfer interrupted";
83 LOG(debug) <<
"Transfer interrupted";
94 for (
int i = 0; i < numInputs; ++i) {
96 if (poller->CheckInput(i)) {
99 if (
Receive(payload, fInChannelName, i) >= 0) {
100 if (
Send(payload, fOutChannelName) < 0) {
101 LOG(debug) <<
"Transfer interrupted";
105 LOG(debug) <<
"Transfer interrupted";
Definition: FairMQMerger.h:26
std::unordered_map< std::string, std::vector< FairMQChannel > > fChannels
Device channels.
Definition: FairMQDevice.h:383
FairMQParts is a lightweight convenience wrapper around a vector of unique pointers to FairMQMessage,...
Definition: FairMQParts.h:21
T GetProperty(const std::string &key) const
Read config property, throw if no property with this key exists.
Definition: ProgOptions.h:69
void Run() override
Runs the device (to be overloaded in child classes)
Definition: FairMQMerger.h:61
int64_t Receive(FairMQMessagePtr &msg, const std::string &channel, const int index=0, int rcvTimeoutInMs=-1)
Definition: FairMQDevice.h:108
int64_t Send(FairMQMessagePtr &msg, const std::string &channel, const int index=0, int sndTimeoutInMs=-1)
Definition: FairMQDevice.h:97
fair::mq::ProgOptions * fConfig
Pointer to config (internal or external)
Definition: FairMQDevice.h:385
void InitTask() override
Task initialization (can be overloaded in child classes)
Definition: FairMQMerger.h:46
bool NewStatePending() const
Returns true if a new state has been requested, signaling the current handler to stop.
Definition: FairMQDevice.h:470
std::shared_ptr< FairMQTransportFactory > fTransportFactory
Default transport factory.
Definition: FairMQDevice.h:379
Definition: FairMQDevice.h:50
privacy