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.