Return-Path: Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: (qmail 17040 invoked from network); 17 Jun 2010 16:08:49 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 17 Jun 2010 16:08:49 -0000 Received: (qmail 21764 invoked by uid 500); 17 Jun 2010 16:08:49 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 21682 invoked by uid 500); 17 Jun 2010 16:08:48 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 21672 invoked by uid 99); 17 Jun 2010 16:08:48 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Jun 2010 16:08:48 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,SPF_HELO_PASS,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.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; Thu, 17 Jun 2010 16:08:41 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1OPHdc-0008Cc-S8 for dev@activemq.apache.org; Thu, 17 Jun 2010 09:08:20 -0700 Message-ID: <28916420.post@talk.nabble.com> Date: Thu, 17 Jun 2010 09:08:20 -0700 (PDT) From: Kumar Pawan To: dev@activemq.apache.org Subject: Sending a message but not able to receieve this mesage. MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: pawankrmodi@gmail.com X-Virus-Checked: Checked by ClamAV on apache.org Sending a message but not able to receieve this mesage. when i change message QueueName then its able receieve for few messsages again i have to change the queue name to receieve next messages. But i am able to see every message sent and receive in ActiveMQ admin. please help me why every time i have change queue name. import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.activemq.ActiveMQConnectionFactory; import javax.jms.*; public class MsgReceiver implements MessageListener { private static int ackMode; private static String messageQueueName; private static String messageBrokerUrl; private Session session; private boolean transacted = false; MessageConsumer consumer = null; CreateDS createDS = new CreateDS(); static { messageBrokerUrl = ReadProperty.getValues("messageBrokerUrl"); messageQueueName = "tmsmevent.messages"; ackMode = Session.AUTO_ACKNOWLEDGE; } private void setupMessageQueueConsumer() throws Exception { ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory( messageBrokerUrl); Connection connection = null; try { connection = connectionFactory.createConnection(); connection.start(); session = connection.createSession(transacted, ackMode); Destination adminQueue = session.createQueue(messageQueueName); // Set up a consumer to consume messages off of the admin queue consumer = session.createConsumer(adminQueue); MsgReceiver msgReceiver = new MsgReceiver(); consumer.setMessageListener(msgReceiver); } catch (Exception e) { // Handle the exception appropriately e.printStackTrace(); } /* * finally * { * try * { * if (consumer != null) * { * consumer.close(); * } * * if (session != null) * { * session.close(); * } * * if (connection != null) * { * connection.close(); * } * } * catch (Exception e) * { * e.printStackTrace(); * } * } */ } public void onMessage(Message message) { try { if (message instanceof TextMessage) { TextMessage txtMsg = (TextMessage) message; String messageText = txtMsg.getText(); System.out.println("Job Name: " + messageText); } } catch (Exception e) { // Handle the exception appropriately e.printStackTrace(); } } public static void main(String[] args) throws Exception { new MsgReceiver().setupMessageQueueConsumer(); } } -- View this message in context: http://old.nabble.com/Sending-a-message-but-not-able-to-receieve-this-mesage.-tp28916420p28916420.html Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.