public void receiveAll() {
   System.out.println("--> Receiving redundant messages ...");
   try {
     QueueBrowser browser = context.createBrowser(myQueue);
     while (browser.getEnumeration().hasMoreElements()) {
       System.out.println("--> here is one");
       context.createConsumer(myQueue).receiveBody(String.class, 1000);
     }
   } catch (JMSException ex) {
     Logger.getLogger(MessageReceiverSync.class.getName()).log(Level.SEVERE, null, ex);
   }
 }
 public int getQueueSize() {
   int count = 0;
   try {
     QueueBrowser browser = context.createBrowser(pointsQueue);
     Enumeration elems = browser.getEnumeration();
     while (elems.hasMoreElements()) {
       elems.nextElement();
       count++;
     }
   } catch (JMSException ex) {
     Logger.getLogger(ReceivePointsBean.class.getName()).log(Level.SEVERE, null, ex);
   }
   Logger.getLogger(ReceivePointsBean.class.getName())
       .log(Level.INFO, "Getting queue size: " + count);
   return count;
 }