Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
BankQuotesInboundAggregator |
|
| 2.5;2.5 |
1 | /* | |
2 | * $Id: BankQuotesInboundAggregator.java 7976 2007-08-21 14:26:13Z 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.examples.loanbroker.routers; | |
12 | ||
13 | import org.mule.routing.AggregationException; | |
14 | import org.mule.routing.inbound.CorrelationAggregator; | |
15 | import org.mule.routing.inbound.EventGroup; | |
16 | import org.mule.umo.UMOMessage; | |
17 | ||
18 | /** | |
19 | * <code>BankQuotesInboundAggregator</code> receives a number of quotes and selects the | |
20 | * lowest | |
21 | */ | |
22 | 0 | public class BankQuotesInboundAggregator extends CorrelationAggregator |
23 | { | |
24 | /** | |
25 | * This method is invoked if the shouldAggregate method is called and returns | |
26 | * true. Once this method returns an aggregated message the event group is | |
27 | * removed from the router | |
28 | * | |
29 | * @param events the event group for this request | |
30 | * @return an aggregated message | |
31 | * @throws AggregationException if the aggregation fails. in this scenario the | |
32 | * whole event group is removed and passed to the exception handler | |
33 | * for this componenet | |
34 | */ | |
35 | protected UMOMessage aggregateEvents(EventGroup events) throws AggregationException | |
36 | { | |
37 | try | |
38 | { | |
39 | 0 | return BankQuotesAggregationLogic.aggregateEvents(events); |
40 | } | |
41 | 0 | catch (Exception e) |
42 | { | |
43 | 0 | throw new AggregationException(events, null, e); |
44 | } | |
45 | } | |
46 | ||
47 | /** | |
48 | * Determines if the event group is ready to be aggregated; this is entirely up | |
49 | * to the application. It could be determined by volume, last modified time or | |
50 | * some other criteria based on the last event received. | |
51 | * | |
52 | * @param events event group to examine | |
53 | * @return true if the events are ready to be aggregated | |
54 | */ | |
55 | protected boolean shouldAggregateEvents(EventGroup events) | |
56 | { | |
57 | 0 | return super.shouldAggregateEvents(events); |
58 | } | |
59 | ||
60 | } |