c++14activemq-cpp

ActiveMQ client: how to share a connection among several producers


I have an application (in C++) whose current deployment profile involves running many copies, as separate processes. Individually, the I/O traffic to and from the ActiveMQ broker is not heavy. We're considering the possibility of running multiple copies of the app, as separate threads within a single program, sharing a single connection to the broker.

The issue is with the producer component in each such copy. Each will naturally have their own session and consumer. The issue is ensuring that the producer components of the various threads (each from a separate session) don't trample the shared connection for outbound traffic.

What are the guarantees, if any, that the client library (ActiveMQ-cpp) will serialize access to the connection in this situation? Or will I have to write a serializing funnel component myself to coordinate the access?


Solution

  • First point is that the activemq-cpp client is not maintained and hasn't seen a release in years so your taking on support yourself if issues are hit.

    The client did have general threading protections in place to prevent issues with multiple threads sending on different or a single producer within the same connection so in theory it should work. In practice your mileage may vary given the age and lack of attention the code has had. As with any messaging application you would also need to measure the that the rate of sending is not in excess of the ability of a single connection to handle.