Messenger: A light-weight, efficient, thread-safe message publish and subscribe tool similar with ROS, a popular robot operating system.
The tool has the following features:
- Header only based on c++11, no extra dependency, makes it portable.
- Thread safe and support multi-thread condition notify mode by setting the queue size.
- Able to transfer any classes efficiently, including ROS defined messages, which means it can replace ROS messagging or work with it.
#include <GSLAM/core/Messenger.h>
int main(int argc,char** argv)
{
Subscriber sub=messenger.subscribe(
"topic_name",[](std::string msg){
std::cerr<<"Received string msg "<<msg<<std::endl;
});
messenger.publish("topic_name","hello world!");
Publisher pub=messenger.advertise<std::string>(
"topic_name");
return 0;
}
- Warning
- The Subscriber will auto shutdown, please hold the Subscriber instance until you want to unsubscribe.
Inter-process Messaging through Network
The core Messenger only provides high performance intra messaging, extra work is needed to support inter-process communication.
GSLAM implemented some plugins to let Messenger support network messaging.
gslam_nsq: https://github.com/pi-gslam/gslam_nsq