0

I am using the following code taking me 18 hrs browsing 1 lac (=100,000) message: I need it in minutes to complete, How can i make it fast complete browsing in 30 mins ?

Integer count = (Integer) jmsTemplate.execute(new SessionCallback() {
            public Object doInJms(Session session) throws JMSException{
                   QueueBrowser browser = session.createBrowser((Queue) jmsTemplate.getDefaultDestination(), messageSelector);


                Enumeration messages = (Enumeration) browser.getEnumeration();

                while (messages.hasMoreElements()) {
                    count++;
                    Message message = (Message) messages.nextElement();
                    TextMessage tm = (TextMessage) message;
                    String messageBody = tm.getText();

                 } }
Shashi
  • 14,980
  • 2
  • 33
  • 52
user3467346
  • 47
  • 10
  • Please help needed ... thanks for any help u extend – user3467346 Jul 21 '14 at 11:20
  • any help will be appreciated – user3467346 Jul 21 '14 at 12:34
  • Why the queue has so many messages piled up? And using a selector also. Browsing a queue with so many messages is going to take time. WebSphere MQ indexes messages on MessageId and CorrelationID. Any search based on these two fields will be faster compared to other fields of a message. My suggestion would be to investigate why messages are piling up in the queue and take action to process messages first. – Shashi Jul 21 '14 at 15:24
  • show your `messageSelector` please. – Stephane Nicoll Jul 22 '14 at 06:15
  • Date startDate = sdf.parse("16/07/2014"); Date endDate = sdf.parse("17/07/2014"); messageSelector = "JMSTimestamp >= " + startDate.getTime() + " AND JMSTimestamp <=" + endDate.getTime(); QueueBrowser browser = session.createBrowser((Queue) jmsTemplate.getDefaultDestination(), messageSelector); – user3467346 Jul 30 '14 at 12:49
  • thanks Shashi and Nicoll for your comments... – user3467346 Jul 30 '14 at 12:51
  • Nicoll if anything i could do in this to make browsing fast... – user3467346 Jul 30 '14 at 12:51
  • Shashi i wwill test with your comments but there are lacs of messages coming in queue .... in 4 hrs ... what are the different ways we can process them fast --- we are using ejb mdb onmessage but that is taking lot of time to process each message – user3467346 Jul 30 '14 at 12:53

0 Answers0