Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 32697 invoked from network); 7 May 2010 12:41:23 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 7 May 2010 12:41:23 -0000 Received: (qmail 74710 invoked by uid 500); 7 May 2010 12:41:23 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 74657 invoked by uid 500); 7 May 2010 12:41:22 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 74649 invoked by uid 99); 7 May 2010 12:41:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 May 2010 12:41:22 +0000 X-ASF-Spam-Status: No, hits=1.0 required=10.0 tests=FORGED_YAHOO_RCVD,FREEMAIL_FROM,SPF_HELO_PASS,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 May 2010 12:41:17 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1OAMrQ-0004cg-Fu for users@activemq.apache.org; Fri, 07 May 2010 05:40:56 -0700 Message-ID: <28485508.post@talk.nabble.com> Date: Fri, 7 May 2010 05:40:56 -0700 (PDT) From: usha Kanteti To: users@activemq.apache.org Subject: Messages not getting persisted while the JMS broker restart MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: u_kanteti@yahoo.com HI, I am newbi to JMS and here is the trouble that I see. 1) I started the jms broker and producer and my producer code produced 10 messages to the topic "myTopic". I see these messages in jconsole with EnqueueCount=10 in "myTopic" 2) I didn't configure any consumers for this topic "myTopic" 2) Now I stopped the jms broker and producer 3) restarted the jms broker and producer and started producing another 10 messages to the same topic 4) Now if I see EnqueueCount on this topic "myTopic", it is still showing 10 but I am thinking, it should be 20 (10 previous ones + 10 current) as they have not been consumed. Now my question is are these messages persisted while the jms broker restart. I use camel activemq and here is my code snippet ######### JMSSERVER Broker public class ConfigureJMSServer { Logger logger = Logger.getLogger(ConfigureJMSServer.class); private static final String jmsServerUrl="tcp://localhost:61616"; public void startServer() { try { BrokerService broker = new BrokerService(); // configure the broker broker.addConnector(jmsServerUrl); broker.setPersistent(true); broker.start(); } catch (Exception e) { logger.info("##### Unable to start JMS Server"); } ############################################## ######### ActiveMQProducer public class ActiveMQProducer { private Connection connection; private Session session; private MessageProducer producer; private MessageConsumer consumer; public void init() throws Exception { ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616"); connection = connectionFactory.createConnection(); session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Topic request = session.createTopic("myTopic"); // and attach a consumer and producer to them producer = session.createProducer(request); producer.setDeliveryMode(DeliveryMode.PERSISTENT); // and start your engines... connection.start(); } public void sendMessage(String messageText) throws Exception { producer.send(session.createTextMessage(messageText)); } public void produce() throws Exception { this.init(); for (int i=0; i < 10; i++ ) { this.sendMessage("TEST TEST TEST"); } // this.destroy(); } ############################################################ my camel configuration ##################################################### Start JMS Server can somebody please suggest me how I can persist the messages in the jms topics if they are not consumed. Thx. -- View this message in context: http://old.nabble.com/Messages-not-getting-persisted-while-the-JMS-broker-restart-tp28485508p28485508.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.