activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: Consumer stops consuming messages from queue.
Date Fri, 29 Aug 2008 11:47:11 GMT
2008/8/29 Jigar Naik <jigarnaik@interactcrm.com>:
>
> I am using ActiveMQ version 5.1.0 with JDK 1.5
>
> "are you using transactions?"
>
> I didn't really get your quesion.

Are you using JMS transactions to consume

>  but after consuming each messages from
> activeMQ i am inserting it into oracle database table
>
> I am not acknowledging the messages  and i have only one consumer.
>
> which continuously reada messages from the queue, on activeMQ console i can
> see Number Of Pending Messages around  4000
>
> bellow is my startConsume method code, which will be called before the
> infinite loop.
>
> public void startConsume(String queueName,String queueConnectionFactory) {
>
>                try {
>                        String sms_connect = Utility.getSMSConnectHome();
>                        File jmsProp = new File((new
> StringBuilder(String.valueOf(sms_connect))).append(File.separator).append("config").append(File.separator).append("JMSConfig.properties").toString());
>                        props.load(new FileInputStream(jmsProp));
>                        JmsUtil.CONNECTION_FACTORY = queueConnectionFactory;
>                        JmsUtil.QUEUE_NAME = queueName;
>                        System.out.println("Queue Name : " + JmsUtil.QUEUE_NAME);
>                        connectionFactory = new
> ActiveMQConnectionFactory(JmsUtil.CONNECTION_FACTORY);
>                        connection = connectionFactory.createConnection();
>                        connection.setExceptionListener(this);
>                        session = connection.createSession(false,
> javax.jms.Session.SESSION_TRANSACTED);

This is an error. We should probably throw an exception here.

You are saying you want to use transacted session ack mode, but not
using the true parameter to indicate transacted consumption.

Since you're not using session.commit() or message.acknowledge() to
acknowledge messages - I'd recommend using Session.AUTO_ACK

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Mime
View raw message