activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JRR <>
Subject ActiveMQ-CPP Producer Flow Control Question
Date Fri, 06 Jul 2012 22:56:31 GMT

I'm having problems with Producer Flow Control. I have a C++ producer that
interacts with a Java application and we are using AMQ to communicate
the two. The AMQ Broker is managed by our Java team, and I've been working
the C++ producer client.

The java team recently changed the broker's configuration so that it won't
consume all available disk space. They've added the following lines to the
activemq.xml configuration file.

		    <systemUsage sendFailIfNoSpace="true">
      				<memoryUsage limit="5 mb" />
      				<storeUsage limit="4 gb" />
      				<tempUsage limit="1 gb" />


After this change we had some long running tests where the consumer was
off line while the C++ producer was continuing to send messages. Eventually
the C++ producer locked up (was flow controlled).

I used GDB to attach to the producer process and found the producer was
on mutexs, etc. deep in the bowels of the 3rd party activemq-cpp code.

I googled sendFailIfNoSpace and landed on the Producer Flow Control page at 

I've read through this several times, and that's where I learned the overall
name of this "lockup up", and that it's actually expected behavior.

What we want is for the broker to limit its disk usage as specified above.
if it reaches the limit the producer gets informed of this, so it can note
fact that the broker is full -- but doesn't lock up.

In reading the producer-flow-control.html page it appears that this is
if we configure client side exceptions -- which the broker does using

However, the second half of this appears to be making the client catch the
javax.jms.ResourceAllocationException. This is were I get lost. This appears
be java code -- which won't work for me as I am C++ based. How do I handle
exception? I suspect they don't mean simply adding try/catch logic because I
would have then expected my C++ producer to crash with an unhandled

I'm assuming that I can do this with the C++ API. How would I do this?

We are using:
    AMQ Broker    5.5.0
    activemq-cpp  3.4.0

We are using:
    1. queues,
    2. they are not durable,
    3. the messages are not persistent, and
    4. we use openwire.

The high level flow for the producer client's AMQ exchange is based upon the
Producer from the CMS API Overview Page

o. Initialize the Active MQ CPP library (once for the process)

o. Create a connection factory using just the broker URI

o. Create a connection from the factory.

o. Start the connection

o. Create a session from the connection using the ack mode of auto

o. Create a destination queue using the session

o. Create a producer using the destination.

o. Change the producer's delivery mode to NON_PERSISTENT

o. Create the message to send using the session

o. Use the producer to send the message.

We have multiple threads sending in the producer. They all use the same
underlying connection, and create sessions on top of the connection for
their messages.

Thanks in advance for your help,


View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message