2 Replies Latest reply on Jun 21, 2010 9:52 AM by PÃ¥l Evensen

    Last-value queue

    PÃ¥l Evensen Novice

      I'm trying to create a last-value queue, but am having trouble understanding how.


      I've created a config like it says in the documentation:




      <address-setting match="coupon.client.numcorrect.#">


      The queues themselves are created dynamically from within the code:


      stompServer.createQueue("coupon.client.numcorrect." + userId, false);


         * Creates a new queue if the specified queue doesn't exist
          * @param queueName
        public void createQueue(String queueName, boolean persistent) throws HornetQException {
          ClientSession.QueueQuery result = session.queueQuery(new SimpleString(queueName));   


            session.createQueue(queueName, queueName, persistent);


      The message is created like this:


      /* (non-Javadoc)
         * @see eventmw.apps.couponmatcher.EventProcessor#processEvent(java.lang.Object)
        public void processEvent(NumCorrectEvent numCorrect) {
          System.out.println("numCorrect=" + numCorrect.getNumCorrect());
          try {
            ClientMessage clientMessage = stompServer.getClientSession().createMessage(true);
            clientMessage.getBodyBuffer().writeNullableSimpleString(new SimpleString(String.valueOf(numCorrect.getNumCorrect())));     
            stompServer.sendSimpleMessage("coupon.client.numcorrect."+numCorrect.getOwner(), clientMessage);
          } catch (Exception e) {


      The documented example uses TextMessage and setStringProperty, but I'm using ClientMessage and getBodyBuffer().writeNullableSimpleString. Is a last-value queue possible to achieve using this interface?