4 Replies Latest reply on Jun 4, 2009 12:51 PM by Claus Ibsen

    Aggregating using XPath

    jamie archibald Apprentice

      I am receiving a message on JMS as follows:

       

       

       

       

      To try and solve this problem I downloaded the source code and have narrowed it down to this which is inside the DefaultAggregationCollection:

       

      Object correlationKey = correlationExpression.evaluate(exchange);

              if (LOG.isDebugEnabled()) {

                  LOG.debug("evaluated expression: " + correlationExpression + " as CorrelationKey: " + correlationKey);

              }

              Exchange oldExchange = map.get(correlationKey);

              Exchange newExchange = exchange;

               

              if (oldExchange != null) {

                  Integer count = oldExchange.getProperty(Exchange.AGGREGATED_COUNT, Integer.class);

                  if (count == null) {

                      count = 1;

                  }

                  count++;

                  newExchange = aggregationStrategy.aggregate(oldExchange, newExchange);

                  newExchange.setProperty(Exchange.AGGREGATED_COUNT, count);

              }

       

       

      For some reason the line map.get(correlationKey) never contains any old exchanges, even though they are added in previous calls to add().

       

      Furthermore, the correlationKey is not the value of the GUID of the element, instead it of type DTMNodeList.

       

      So it looks like there are two issues here:

       

      #1) For some reason my exchanges that are stored in the correlation map are getting removed sometime after they are added.

       

      #2) The XPath is not using the value of the attribute for correlation.

       

      Perhaps what I am trying to do is not possible with the aggregator, or is it?

       

      I'm using 1.5.3.0 of the mediation router.

       

      Much thanks