Firstly, where do I find the source for the ATM code. I believe it has message driven beans??? But more importantly, the following code puts orion in a spin:
 
      QueueConnection connection = null;
      QueueSession session = null;
      Queue queue = null;
      QueueSender sender = null;
      TextMessage message = null;
 
      try {
        connection = CatsUtils.getJMSConnection();
        connection.start();
 
        session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
 
        queue = (Queue)CatsUtils.lookup(CatsUtils.EJB_ENVIRONMENT_NAME + "jms/CatsInQueue", Queue.class);
 
        QueueBrowser browser = session.createBrowser(queue);
        int i = 0;
        Enumeration e = browser.getEnumeration();
        while (e.hasMoreElements())
        {
          i++;
        }
        System.out.println("There are currently " + i + " message(s) on the queue.");
 
//        sender = session.createSender(queue);
//
//        message = session.createTextMessage();
//        message.setJMSDestination(queue);
//        message.setText(xmlString);
//
//        sender.send(message);
      }
      catch (Exception e)
      {
        e.printStackTrace();
      }
      finally
      {
        try
        {
          if (sender != null)
          {
            sender.close();
          }
          if (session != null)
          {
            session.close();
          }
          if (connection != null)
          {
            connection.close();
          }
        }
        catch (Exception e)
        {
          // Ignore it
        }
      }

Reply via email to