3 Replies Latest reply on Nov 13, 2009 4:40 AM by Tim Fox

    Questio on setting group association in delivery algo

    Tim Fox Master

      Another question:

      Currently the group--consumer association is set before the consumer has handled the reference:

      final SimpleString groupID = reference.getMessage().getSimpleStringProperty(MessageImpl.HDR_GROUP_ID);
      
       if (groupID != null)
       {
       Consumer groupConsumer = groups.putIfAbsent(groupID, consumer);
      
       if (groupConsumer != null && groupConsumer != consumer)
       {
       continue;
       }
       }
      
       HandleStatus status = handle(reference, consumer);
      


      And then, if the consumer doesn't handle it, it is removed:

      else if (status == HandleStatus.NO_MATCH)
       {
       // if consumer filter reject the message make sure it won't be assigned the message group
       if (groupID != null)
       {
       groups.remove(consumer);
       }
       }
      


      Why not just set it after the consumer has handled it, then you know it's been handled?