The fact that you create a new ActiveMQ connection for each message seems
like the probable cause for the error you saw.  If you had a surge of N
messages to process all at once, you'd have N connections open (I'm
assuming you're processing your messages asynchronously), so if N was large
enough, you could overrun the limit for the number of concurrent
connections.

The Spring page <http://activemq.apache.org/spring-support.html> of the
ActiveMQ documentation recommends using a pooled connection factory
(org.apache.activemq.pool.PooledConnectionFactory) when working with
Spring's JmsTemplate, and I would think you'd want to do the same.  (Maybe
you'd also want to use Spring's JmsTemplate, too?)  I haven't used ActiveMQ
without the support of another framework (Spring or Camel), so I don't have
concrete tips for exactly how to use a PooledConnectionFactory, but
hopefully the page I linked plus what you find from Googling will give you
enough to figure it out.

Tim

On Tue, Sep 23, 2014 at 12:06 AM, venkatesh <venkatesh.sti...@gmail.com>
wrote:

> Hi Tim,
>
> Please find more details related to this issue and also answers for your
> below questions
>
> Your Question: Was there anything unusual in the logs around the time the
> errors were seen?
> Answer: Actually No, But there is one scenario during our performance test
> where this issue occurs but it's not a valid scenario
>
> Your Question: Finally, your stack trace from several days ago shows that
> com.spacetimeinsight.alerts.util.MessagingUtils.sendMessage() calls
> org.apache.activemq.ActiveMQConnection.createSession().
>
> Answer: Please find below code snippet once.
> try {
>                         ConnectionFactory connectionFactory =
> (ConnectionFactory)
> JNDIUtils.getJNDIResouceSource(resourceName);
>                         connection = connectionFactory.createConnection();
>                         Session session = connection.createSession(false,
> Session.CLIENT_ACKNOWLEDGE);
>                         connection.start();
>                         MessageProducer producer =
> session.createProducer((Destination)
> JNDIUtils.getJNDIResouceSource(destinationName));
>                         producer.send(buildMessage(msg, msgType,
> session,props));
>                 } catch (Exception e) {
>                         //some code here
>                 } finally {
>                         if (connection != null) {
>                                 try {
>                                         connection.close();
>                                 } catch (JMSException e) {
>                                         // TODO Auto-generated catch block
>                                         Logger.error("Exception is
> sendMessage  while close connection ",
> MessagingUtils.class, e);
>                                 }
>                         }
>
> Question: Do you create a new AMQ session for every message you send?
> Answer: Yes
>
> Question: Is there any caching/pooling being done?
> Answer: No
>
>
> Thanks,
> Venkatesh
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/what-is-the-Root-cause-and-how-to-resolve-the-error-i-e-javax-jms-JMSException-No-buffer-space-avail-tp4685440p4685778.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Reply via email to