3 Replies Latest reply on Apr 5, 2006 12:40 PM by ovidiu.feodorov

    doNegAcknowledge() does not work!

    manuelstefanjung

      Guys i need your help...

      we would like to collect new messages from a JMS Queue and doing a acknowledge for every message seperatly, but the following code seems not to work correctly:

      first the initalisation of the Queue:

      outputQueue = (Queue) ctx.lookup(odinApiProperties.getProperty("jndi.itex.queue.output"));
      QueueConnectionFactory outqcFactory = (QueueConnectionFactory) javax.rmi.PortableRemoteObject.narrow(
      ctx.lookup(odinApiProperties.getProperty("jndi.itex.conn.factory")),
      QueueConnectionFactory.class);
      outputQueueConnection = outqcFactory.createQueueConnection();
      outputQueueConnection.start();
      outputQueueSession = outputQueueConnection.createQueueSession(false, TopicSession.CLIENT_ACKNOWLEDGE);
      outputQueueReceiver = outputQueueSession.createReceiver(outputQueue);

      now we consuming the message with:
      currentMessage = outputQueueReceiver.receiveNoWait();
      orderXML = ((SpyTextMessage) currentMessage).getText();

      doing something with orderXML and after that commit with:
      ((SpyTextMessage) currentMessage).doNegAcknowledge();

      on the next way i want to get this message again, it works...
      but if i acknowledge it with

      currentMessage.acknowledge();

      is seems not to work. I always get the same message with the next consuming..

      Can somebody help me?
      Thx!

      Mr. Jung








      Our acknowledge does not work

      outputQueue = (Queue) ctx.lookup(odinApiProperties.getProperty("jndi.itex.queue.output"));
      QueueConnectionFactory outqcFactory = (QueueConnectionFactory) javax.rmi.PortableRemoteObject.narrow(
      ctx.lookup(odinApiProperties.getProperty("jndi.itex.conn.factory")),
      QueueConnectionFactory.class);
      outputQueueConnection = outqcFactory.createQueueConnection();
      outputQueueConnection.start();
      outputQueueSession = outputQueueConnection.createQueueSession(false, TopicSession.CLIENT_ACKNOWLEDGE);
      outputQueueReceiver = outputQueueSession.createReceiver(outputQueue);
      currentMessage = outputQueueReceiver.receiveNoWait();