|
DUNE-DAQ
DUNE Trigger and Data Acquisition software
|
Inter-Process Messaging
The IPM library provides the low-level library for for sending messages between DUNE DAQ processes. IPM deals with messages consisting of arrays of bytes: higher-level concepts such as object serialization/deserialization will be handled by other libraries and processes building on IPM.
IPM provides two communication patterns:
Users should interact with IPM via the interfaces dunedaq::ipm::Sender, dunedaq::ipm::Receiver and dunedaq::ipm::Subscriber, which are created using the factory functions dunedaq::ipm::makeIPM(Sender|Receiver|Subscriber), which each take a string argument giving the implementation type. The currently-available implementation types all use ZeroMQ, and are:
Additioanlly, the CallbackAdapter class implements callback functionality for the ZmqReceiver and ZmqSubscriber class, since ZeroMQ does not have a native callback functionality. It does this by managing a thread which calls receive in a loop, calling the given function when data is returned.
Basic example of the sender/receiver pattern:
Basic example of the publisher/subscriber pattern:
More complete examples can be found in the test/plugins directory.
There is an asymmetry between send and receive, where send takes a void* and receive returns a std::vector<char>. This is a result of the fact that IPM does not own the memory being passed to send, but it does have to transfer the memory returned from receive.

Currently, ZmqContext.hpp has two environment variables used to configure ZeroMQ within each application: