Network based messaging
hans at fugal.net
Thu Jul 24 17:23:15 MDT 2008
Dave Smith wrote:
> I've been looking for a good messaging system in Linux to send simple
> messages between different pieces of software I'm developing. I would
> like a central messaging service that handles moving messages around the
> network for me, such that each application can connect to the messaging
> service and get messages as they arrive. The messages are of a broadcast
> nature and each app doesn't necessarily need to know about all the other
> apps who happen to care about its messages (they should remain
> de-coupled). The various applications will not be on the same host, so
> network-based is a must, and it must be able to span broadcast domains.
> I've looked at JMS and threw it out because of the Java dependencies. My
> software is mostly Python and C++. I also looked at (and used) CORBA,
> but it's too complex and the learning curve is killer. What I really
> want is D-Bus, but currently D-Bus doesn't support remote messaging
> since it relies on Unix Domain Sockets.
The IRC idea is neat and novel. If you don't go with that, though, and
unless you find something already made that suits (in which case let us
know, it sounds useful), I'd just roll your own. If your needs are as
simple as you say...
The two hard parts are the message encoding and the network code (esp if
you use C/C++). Depending on the nature of your messages, OSC might
be a good fit. liblo (there's a python library too, I'm sure) makes
OSC easy in C/C++ (esp in the common case of UDP transport). All you'd
have to do is set up a repeating server that recognizes
registration/deregistration messages (or use TCP and keep a list of
sockets) and repeat the rest (standard observer pattern).
If you hadn't mentioned C++, I might say go with a simple text-based
protocol (maybe something based on YAML or email-like, depending on the
nature of your messages). It hardly gets easier than that. Of course, it
does get harder if you please - xmlrpc, soap, etc. all the way up to corba.
Hans Fugal ; http://hans.fugal.net
There's nothing remarkable about it. All one has to do is hit the
right keys at the right time and the instrument plays itself.
-- Johann Sebastian Bach
More information about the PLUG