New metadata TRestMessengerAndReceiver added!

We have added new metadata class TRestMessengerAndReceiver to recieve/dispatch messages across processes(UNIX process). This makes it possible to run REST as a “service”. For example, every time it recieves a message, we make it print “hello world”:

in restRoot, window 1:

root [0] TRestMessengerAndReceiver rec("116028");
root [1] while(1){if(rec.ConsumeMessage()!=""){cout<<"hello world"<<endl;}usleep(100);}

in restRoot, window 2:

root [0] TRestMessengerAndReceiver rec("116028");
root [1] rec.SendMessage("aaa");
root [2] rec.SendMessage("bbb");

We can see that window 1 will print “hello world” every time we send the message in window 2.

When receiving message, the logic of TRestMessengerAndReceiver is more like “consuming”: each time it takes out one piece of message from the pool and given to the specific process. The message will be erased after being consumed. TRestMessengerAndReceiver cannot consume the message sent by self process.

1 Like

This is a very interesting feature. I understand that a REST process can create this object, and during the processing we are able to receive the messages of the process externally.

But in your particular case, what motivated the construction of this class?

We want to process the daq output file in realtime. Everytime the daq generates a file, it will call restManager to process this file. One file → one restManager, this is to enhance stability, in case one file crahes due to the occational bug in the process. Then, when the process of a file is finished, we need to notify the drawing process to make it do the drawings immediately. Then, we can see the analysis plots during data taking