This is related to the following post:

http://www.nabble.com/Messages-%27stuck%27-on-queue%2C-until-client-restart-tf3017349.html#a8379662

For the version, I went to the following page:
http://www.activemq.org/site/activemq-410-release.html

and pulled: apache-activemq-4.1.0-incubator.zip or
apache-activemq-4.1.0-incubator.tar.gz depending upon my test environment.

Below is my method for creating the consumer - at the moment no producers
are created, i.e. this consumer does not push the message to another queue.
    public void afterPropertiesSet() throws Exception {
        Assert.hasText(name, "You must set the name property in the spring
config file");
        Assert.hasText(id, "You must set the consumer ID property in the spring
config file");
        Assert.notNull(messageListener, "You must set the
MessageConsumerListener property in the spring config file");
        Assert.notNull(connectionFactory, "You must set the
connectionFactory in the spring config file");
        
        log.info("Attempting to obtain a transacted session from JMS
ConntectionFactory in class: " + this.getClass().getName());
        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;
        }
        
    }

 to read a message I ultimately perform the following:

               message = messageConsumer.receive(5000);

Thanks for any help.

Pat




James.Strachan wrote:
> 
> Which version are you using? Also what kind of consumer is it
> (transactional / sync/async etc)
> 
> On 1/17/07, YoungSoul <[EMAIL PROTECTED]> wrote:
>>
>>
>> I see this frequently - and I just can't believe that others are not
>> either.
>>
>> So either, amq is fine and my usage of it is incorrect somehow or there
>> is
>> something fundementally wrong with it.
>>
>> There does not seem to be a pattern for when a message is stuck.  My
>> simple,
>> simple app posts messages very infrequently.  1 every few seconds.  Most
>> of
>> the time the messages get through, sometimes one gets stuck.  I have a
>> single client pulling the message off.  I can see the message in the
>> queue
>> browser but it wont come off the queue.
>>
>> thanks
>> --
>> View this message in context:
>> http://www.nabble.com/Is-anyone-else-seeing-messages-stuck-on-a-queue--tf3027911.html#a8412294
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> 
> James
> -------
> http://radio.weblogs.com/0112098/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Is-anyone-else-seeing-messages-stuck-on-a-queue--tf3027911.html#a8413018
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to