1 Reply Latest reply on Jul 9, 2004 11:25 PM by Adrian Brock

    Problems getting createReceiver to filter correctly

    jens schutt Newbie

      I'm using Jboss 3.2.3 and have JMS working for a number of MBeans, but I have run into a problem when I'm trying to filter on a message queue using createReceiver(queue, selector); it never returns anything. I have tried filting on the JMSmessageID as well as a user defined Property but in both cases the result is the same nothing is allowed trough the filter. I looked in the J2EE spec's and the format for the selector string should be SQL92 e.g. JSession = 'ACD27215A35118EFAC6DA9BCD7DA4BB2'

      Any help would be great.

      TIA
      Jens
      eViking Inc.

      byte[] pdfByteArray = null;
      if (session.getAttribute("rptMsg") != null) {
      try {
      InitialContext iniCtx = new InitialContext();
      Object tmp = iniCtx.lookup("ConnectionFactory");
      QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
      Queue que = (Queue) iniCtx.lookup("queue/completedWork");
      QueueConnection conn = qcf.createQueueConnection();
      QueueSession qsession =
      conn.createQueueSession(false,
      QueueSession.AUTO_ACKNOWLEDGE);
      String selector = "JSession = '"+session.getAttribute("rptMsg")+"'";
      QueueReceiver filteredQueueReceiver =
      qsession.createReceiver(que,selector);
      ObjectMessage msg =
      (ObjectMessage) filteredQueueReceiver.receive(1000);
      if (msg != null) {
      responseMessage rm= (responseMessage) msg.getObject();
      pdfByteArray = rm.getOutput();
      }
      } catch (Exception ex) {
      System.out.println(ex.toString());
      }