- OnData() channel data handler. - ConditionalRun() for devices without incoming data. - Header file with common main(), to be extended with getDevice/addCustomOptions. - Update examples (MQ/Tutorial3) to use the new API and config. - NewSimpleMessage() for simpler creation of small messages (additional copy). - Replace SetProperty/GetProperty with fConfig access. - Runtime configurable channel names for common devices. - Configurable logging interval per channel. - FairMQMultiplier for distributing same data to multiple outputs. - Cleanup state machine messages. - Cmd option to toggle signal handling. - Simpler API for send/receive timeouts. - Enable --log-to-file. - Fix coverity issues, warnings. - Various code cleanup and minor tweaks. |
||
---|---|---|
.. | ||
CMakeLists.txt | ||
ex8-multipart.json | ||
FairMQEx8Header.h | ||
FairMQExample8Sampler.cxx | ||
FairMQExample8Sampler.h | ||
FairMQExample8Sink.cxx | ||
FairMQExample8Sink.h | ||
README.md | ||
runExample8Sampler.cxx | ||
runExample8Sink.cxx | ||
startMQEx8.sh.in |
Example 8: Sending Multipart messages
A topology of two devices - Sampler and Sink, communicating with PUSH-PULL pattern.
The Sampler sends a multipart message to the Sink, consisting of two message parts - header and body.
Each message part is a regular FairMQMessage. To combine them into a multi-part message, simply send all but the last part with SendPart()
and the last part with Send()
as shown in the example.
The ZeroMQ transport guarantees delivery of both parts together. Meaning that when the Receive call of the Sink receives the first part, following parts have arrived too.
The header contains a simple data structure with one integer. The integer in this structure is used as a stop flag for the sink. As long as its value is 0, the Sink will keep processing the data. Once its value is 1, the Sink will exit its Run()
method.