View Javadoc

1   /*
2    * $Id: BankQuotesResponseAggregator.java 11567 2008-04-11 13:08:05Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.example.loanbroker.routers;
12  
13  import org.mule.api.MuleMessage;
14  import org.mule.routing.AggregationException;
15  import org.mule.routing.CollectionCorrelatorCallback;
16  import org.mule.routing.EventCorrelatorCallback;
17  import org.mule.routing.inbound.EventGroup;
18  import org.mule.routing.response.ResponseCorrelationAggregator;
19  
20  /**
21   * <code>BankQuotesInboundAggregator</code> receives a number of quotes and selects the
22   * lowest
23   */
24  public class BankQuotesResponseAggregator extends ResponseCorrelationAggregator
25  {
26      //@Override
27      protected EventCorrelatorCallback getCorrelatorCallback()
28      {
29          return new CollectionCorrelatorCallback()
30          {
31  
32              public MuleMessage aggregateEvents(EventGroup events) throws AggregationException
33              {
34                  try
35                  {
36                      return BankQuotesAggregationLogic.aggregateEvents(events);
37                  }
38                  catch (Exception e)
39                  {
40                      throw new AggregationException(events, null, e);
41                  }
42              }
43          };
44      }
45  }