A simple AMQ CMS (C++ Messaging System) example
I support an application with a use case where messages are pumped into an ActiveMQ message broker from a native application on a FreeBSD box. I've written several iterations of this systems attempting to keep a KISS principal. My first implementation was written in Java using JMS and worked perfectly for about a year, until another application was installed on the machine which ate all of the available memory. The second implementation written in Ruby using STOMP is also working well. However my client was hoping to allocate a maximum of 1MiB of resident RAM to the process, so back to the drawing board I went.
So in my search I came across AcitveMQ CPP. After a brief coffee break reading the documentation on ActiveMQ CPP while the library compiled I set out to implement a simple example of publishing a message. I was amazed of how similar the API was to JMS, with addition of C++ memory management.
Unfortunately the smallest example I found was only 403 lines of code. So I wrote a minimalist example in only 53 lines of code.