activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Thieme <activemq-us...@athieme.com>
Subject Re: Client unable to receive messages (after some time) when using PooledConnectionFactory
Date Wed, 08 Mar 2006 13:41:11 GMT

I am hoping you might have a few spare moments to come back to my earlier 
question. Incidentally, I was able to get the configuration working using 
the message driven model (i.e. MessageListener). However, in thinking more 
about the problem I am trying to solve, I realized that there are cases 
where the required behavior is to process messages synchronously, using a 
call to receive.

So, when using non-pooled connections, which appears to be the only way 
ActiveMQ will continue to function over long periods of in activity 
(again, using the PooledConnectionFactory alternative), I quickly start to 
run out of memory. So, I suspect this is a result of creating a new 
connections, session, etc for each call to receive; but, what I don't 
understand is why these resources are not freed up. If you know of a 
problem in this area (either my config, Spring or AcitveMQ) please let me 
know.

Aside from it not being the *recommended* solution, I'm still interested 
to know if there is a known issue/limitation with using the 
PooledConnectionFactory for receives that receives begin to fail after a 
period of inactivity (e.g. the pooled connections get stale, closed and 
new ones are never reopened).

At this stage, I'm running with ActiveMQ on a development setup; but, I'm 
using Weblogic in my production staging setup since I can't find an 
ActiveMQ setup that meets all of my needs:

  1.) consumers are able to use the recieve() call -- to process messages 
one at a time (since my app is not thread safe)
  2.) consumers are always able to receive (regardless of whether there 
were periods of inactivity)
  3.) does not run out of memory, presumably due to creating 
connections/sessions/etc.

Thanks and I hope you can help.

Alex

On Mon, 27 Feb 2006, Alex Thieme wrote:

> 
> Thanks for the reply.
> 
> I am actually using Spring JmsTemplates for both sending and receiving. Is 
> there a known issue/limitation with using the PooledConnectionFactory for 
> receives? As for using mdbs, I was hoping to avoid coding to MessageListener. 
> So, is using "Spring Remoting with Jencks using the Lingo library" my only 
> option (with ActiveMQ)? My question is coming from I'd rather not incorporate 
> another set of libraries if it can be avoided (i.e. there is a way to get the 
> PooledConnectionFactory working).
> 
> Alex
> 
> On Mon, 27 Feb 2006, James Strachan wrote:
> 
>> Note that the PooledConnectionFactory is only designed for sending of 
>> messages - and is purely designed for folks using Spring's JmsTemplate to 
>> send messages without under the covers creating and closing a 
>> MessageProducer for every message sent.
>> 
>> If you want to pool connections/sessions/consumers for the inbound 
>> consumption of messages we recommend using either
>> 
>> * Message Driven Beans in a J2EE container like Geronimo
>> * Message Driven POJOs using Jencks (http://jencks.org/)
>> * try Spring JMS in Spring 2.0 - though this does not support XA AFAIK
>> 
>> James
>> 
>> On 25 Feb 2006, at 15:44, Alex Thieme wrote:
>>> Hello,
>>> 
>>> I am currently running with version 3.2.1, an embedded broker, with clients 
>>> using the reliable protocol, and a pooled connection factory (all defined 
>>> using Spring, if that makes a difference). After some time running, sending 
>>> messages successfully, the producers (to a few queues) are still able to 
>>> send messages, but the corresponding consumers are no longer able to 
>>> receive. The call to receive returns null, and does not throw an Exception.
>>> 
>>> As a test, I switched to NOT use the pooled connection factory, and low and 
>>> behold my tests ran to completion (i.e. consumers were able to receive all 
>>> messages where before they would have failed).
>>> 
>>> The Spring configuration I am using is included below (both the pooled and 
>>> non-pooled versions).
>>> 
>>> Incidentally, I added the "useAsyncSend" property to the connection factory 
>>> in an attempt to speed things up and and ?keepAliveTime=-1 to my broker in 
>>> an attempt to say "don't ever consider the connection to be dead". I don't 
>>> know if either of these are relevant, used, etc. I'm open to other 
>>> properties/options to make things more reliable (required) and perform as 
>>> fast as possible (desired).
>>> 
>>> I see there was an update to 3.2.2; but, I don't see anything in the change 
>>> log that speaks to this type of problem.
>>> 
>>> Thanks in advance for any help.
>>> 
>>> Alex
>>> 
>>> BTW, I apologize for the repost (originally sent to activemq-users); but, I 
>>> wasn't sure where the right place was to post this, and that list didn't 
>>> seem to be all that active.
>>> 
>>> <!-- working version -->
>>>
>>>    <bean id="Jms.ConnectionFactory.Embedded"
>>>          class="org.activemq.ActiveMQConnectionFactory"
>>>          singleton="true"
>>>          lazy-init="true">
>>>        <property name="brokerURL" ref="Jms.BrokerUrl"/>
>>>        <property name="useAsyncSend" value="true"/>
>>>        <property name="useEmbeddedBroker" value="true"/>
>>>    </bean>
>>>
>>>    <!-- A connection factory, expects broker to be running already -->
>>>    <bean id="Jms.ConnectionFactory"
>>>          class="org.activemq.ActiveMQConnectionFactory"
>>>          singleton="true"
>>>          lazy-init="true">
>>>        <property name="brokerURL" ref="Jms.BrokerUrl"/>
>>>        <property name="useAsyncSend" value="true"/>
>>>        <property name="useEmbeddedBroker" value="false"/>
>>>    </bean>
>>> 
>>> <!-- Non-working version -->
>>>
>>>    <!-- A connection factory, using the embedded broker -->
>>>    <bean id="Jms.ConnectionFactory.Pooled.Embedded"
>>>          class="org.activemq.pool.PooledConnectionFactory"
>>>          singleton="true"
>>>          lazy-init="true">
>>>        <property name="connectionFactory">
>>>            <bean class="org.activemq.ActiveMQConnectionFactory">
>>>                <property name="brokerURL" ref="Jms.BrokerUrl"/>
>>>                <property name="useAsyncSend" value="true"/>
>>>                <property name="useEmbeddedBroker" value="true"/>
>>>            </bean>
>>>        </property>
>>>    </bean>
>>>
>>>    <!-- A connection factory, expects broker to be running already -->
>>>    <bean id="Jms.ConnectionFactory.Pooled"
>>>          class="org.activemq.pool.PooledConnectionFactory"
>>>          singleton="true"
>>>          lazy-init="true">
>>>        <property name="connectionFactory">
>>>            <bean class="org.activemq.ActiveMQConnectionFactory">
>>>                <property name="brokerURL" ref="Jms.BrokerUrl"/>
>>>                <property name="useAsyncSend" value="true"/>
>>>                <property name="useEmbeddedBroker" value="false"/>
>>>            </bean>
>>>        </property>
>>>    </bean>
>> 
>> 
>> James
>> -------
>> http://radio.weblogs.com/0112098/
>

Mime
View raw message