I am not using the ResourceAdapter.  This application is basically one that
I had written back in the day with version 3, and I now have the opportunity
to reuse most of that application and I was trying to get it to work with
the latest ActiveMQ.

So I know this did work in the 3.x version.

I basically followed the 'CompetingConsumer' pattern.  I developed them as
Spring Beans and my afterPropertiesSet method looks like: ( btw: the
connectionFactory which is a simple wrapper will make sure that the
connection is started as part of the create.  I am also using pooled
connections so a client app might decide to have a few connections shared by
any number of sessions. Some minor logging and error checking removed) 

    public void afterPropertiesSet() throws Exception {
        
        Connection conn = connectionFactory.createConnection();
        if( conn != null ) {
            session = conn.createSession(true, Session.SESSION_TRANSACTED);
            
            Queue readQueue = session.createQueue(readQueueName);
            messageConsumer = session.createConsumer(readQueue);
            if( writeQueueNames != null ) {
                    for (Iterator iter = writeQueueNames.iterator();
iter.hasNext();) {
                        String writeQueueName = (String) iter.next();
                        Queue writeQueue = session.createQueue(writeQueueName);
                        MessageProducer mp = session.createProducer(writeQueue);
                        mp.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
                        messageProducers.add(mp);
                        queue2MessageProducerMap.put(writeQueueName,mp);
                    }
            }
            
            if( deadQueueName != null ) {
                Queue deadLetter = session.createQueue(deadQueueName);
                deadMessageQueue = session.createProducer(deadLetter);
               
deadMessageQueue.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
            }
            initialized = true;
        }
        
    }

I did create a junit to receive messages and a sender tool ( modeled after
your producertool ) to recreate this.  In this case, I am sending one
message every 2 seconds from a windows client, to a Linux AMQ server, to a
consumer running on the same windows machine.  After about 2300 messages, I
started seeing messages left in the queue.

I would be happy to zip the entire eclipse project and make that available
if that is helpful.  This might certainly be something in my implementation
or configuration, so I will continue to try to reduce the test case to the
bare minimum that I can.

Thanks again.

Pat



Christopher G. Stach II wrote:
> 
> YoungSoul wrote:
>> 
>> To be specific about the release I used:
>> 
>> I went to the following url: 
>> http://www.activemq.org/site/activemq-410-release.html
>> and downloaded either apache-activemq-4.1.0-incubator.zip or
>> apache-activemq-4.1.0-incubator.tar.gz depending upon the environment I
>> was
>> interested in.
>> 
>> Thanks for your reply and help you can provide.
>> 
>> Pat
>> 
>> 
>> 
>> 
>> James.Strachan wrote:
>>> On 1/15/07, YoungSoul <[EMAIL PROTECTED]> wrote:
>>>> I seem to be having problems with 'stuck' messages on a queue.
>>>>
>>>> I am running with the latest ActiveMQ release.
>>> By 'latest release' are you talking about 4.1? There were some fixes
>>> in this area in 4.1 - could you be more specific please?
>>>
>>> -- 
>>>
>>> James
>>> -------
>>> http://radio.weblogs.com/0112098/
>>>
>>>
>> 
> 
> Are you using AMQ's ResourceAdapter?
> 
> -- 
> Christopher G. Stach II
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Messages-%27stuck%27-on-queue%2C-until-client-restart-tf3017349.html#a8394580
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to