mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 17:41:45 +00:00
Don't use to-be-deprecated names
This commit is contained in:
committed by
Dennis Klein
parent
f15f669853
commit
bfd08bb33f
@@ -5,4 +5,4 @@ This example demonstrates how to work with multiple channels and multiplex betwe
|
||||
|
||||
A topology of three devices - **Sampler**, **Sink** and **Broadcaster**. The Sampler sends data to the Sink via the PUSH-PULL pattern. The Broadcaster device sends a message to both Sampler and Sink containing a string "OK" every second. The Broadcaster sends the message via PUB pattern. Both Sampler and Sink, besides doing their PUSH-PULL job, listen via SUB to the Broadcaster.
|
||||
|
||||
The multiplexing between their data channels and the broadcast channels happens with `FairMQPoller`.
|
||||
The multiplexing between their data channels and the broadcast channels happens with `fair::mq::Poller`.
|
||||
|
@@ -22,7 +22,7 @@ struct Broadcaster : fair::mq::Device
|
||||
|
||||
// NewSimpleMessage creates a copy of the data and takes care of its destruction (after the transfer takes place).
|
||||
// Should only be used for small data because of the cost of an additional copy
|
||||
FairMQMessagePtr msg(NewSimpleMessage("OK"));
|
||||
fair::mq::MessagePtr msg(NewSimpleMessage("OK"));
|
||||
|
||||
LOG(info) << "Sending OK";
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
********************************************************************************/
|
||||
|
||||
#include <fairmq/Device.h>
|
||||
#include <FairMQPoller.h>
|
||||
#include <fairmq/Poller.h>
|
||||
#include <fairmq/runDevice.h>
|
||||
|
||||
#include <chrono>
|
||||
@@ -26,13 +26,13 @@ struct Sampler : fair::mq::Device
|
||||
|
||||
void Run() override
|
||||
{
|
||||
FairMQPollerPtr poller(NewPoller("data", "broadcast"));
|
||||
fair::mq::PollerPtr poller(NewPoller("data", "broadcast"));
|
||||
|
||||
while (!NewStatePending()) {
|
||||
poller->Poll(100);
|
||||
|
||||
if (poller->CheckInput("broadcast", 0)) {
|
||||
FairMQMessagePtr msg(NewMessage());
|
||||
fair::mq::MessagePtr msg(NewMessage());
|
||||
|
||||
if (Receive(msg, "broadcast") > 0) {
|
||||
LOG(info) << "Received broadcast: \"" << std::string(static_cast<char*>(msg->GetData()), msg->GetSize()) << "\"";
|
||||
@@ -42,7 +42,7 @@ struct Sampler : fair::mq::Device
|
||||
if (poller->CheckOutput("data", 0)) {
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
|
||||
FairMQMessagePtr msg(NewSimpleMessage(fText));
|
||||
fair::mq::MessagePtr msg(NewSimpleMessage(fText));
|
||||
|
||||
if (Send(msg, "data") > 0) {
|
||||
LOG(info) << "Sent \"" << fText << "\"";
|
||||
|
@@ -27,7 +27,7 @@ struct Sink : fair::mq::Device
|
||||
fMaxIterations = fConfig->GetProperty<uint64_t>("max-iterations");
|
||||
}
|
||||
|
||||
bool HandleBroadcast(FairMQMessagePtr& msg, int /*index*/)
|
||||
bool HandleBroadcast(fair::mq::MessagePtr& msg, int /*index*/)
|
||||
{
|
||||
LOG(info) << "Received broadcast: \"" << std::string(static_cast<char*>(msg->GetData()), msg->GetSize()) << "\"";
|
||||
fReceivedBroadcast = true;
|
||||
@@ -35,7 +35,7 @@ struct Sink : fair::mq::Device
|
||||
return CheckIterations();
|
||||
}
|
||||
|
||||
bool HandleData(FairMQMessagePtr& msg, int /*index*/)
|
||||
bool HandleData(fair::mq::MessagePtr& msg, int /*index*/)
|
||||
{
|
||||
LOG(info) << "Received message: \"" << std::string(static_cast<char*>(msg->GetData()), msg->GetSize()) << "\"";
|
||||
fReceivedData = true;
|
||||
|
Reference in New Issue
Block a user