Hello,

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
between
the two. The AMQ Broker is managed by our Java team, and I've been working
with
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>
                    <systemUsage sendFailIfNoSpace="true">
                        <memoryUsage>
                                <memoryUsage limit="5 mb" />
                        </memoryUsage>
                        <storeUsage>
                                <storeUsage limit="4 gb" />
                        </storeUsage>
                        <tempUsage>
                                <tempUsage limit="1 gb" />
                        </tempUsage>
                        </systemUsage>
                </systemUsage>

---------------------------------------------------------------------------

After this change we had some long running tests where the consumer was
taken
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
blocked
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
     http://activemq.apache.org/producer-flow-control.html
http://activemq.apache.org/producer-flow-control.html 

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.
And
if it reaches the limit the producer gets informed of this, so it can note
the
fact that the broker is full -- but doesn't lock up.

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

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
to
be java code -- which won't work for me as I am C++ based. How do I handle
this
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
exception.

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
(http://activemq.apache.org/cms/cms-api-overview.html)


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

o. Create a connection factory using just the broker URI
   (tcp://localhost:61616)

o. Create a connection from the factory.

o. Start the connection

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

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
sending
their messages.

Thanks in advance for your help,

-=John

--
View this message in context: 
http://activemq.2283324.n4.nabble.com/ActiveMQ-CPP-Producer-Flow-Control-Question-tp4653781.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to