Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
EventCorrelatorCallback |
|
| 1.0;1 |
1 | /* | |
2 | * $Id: EventCorrelatorCallback.java 11531 2008-04-08 15:34:34Z rossmason $ | |
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 | package org.mule.routing; | |
11 | ||
12 | import org.mule.routing.inbound.EventGroup; | |
13 | import org.mule.api.MuleMessage; | |
14 | import org.mule.api.MuleEvent; | |
15 | import org.mule.api.routing.RoutingException; | |
16 | ||
17 | /** | |
18 | * A callback used to allow pluggable behaviour when correlating events | |
19 | */ | |
20 | public interface EventCorrelatorCallback | |
21 | { | |
22 | /** | |
23 | * Determines if the event group is ready to be aggregated. if the group is ready | |
24 | * to be aggregated (this is entirely up to the application. it could be | |
25 | * determined by volume, last modified time or some oher criteria based on the | |
26 | * last event received). | |
27 | * | |
28 | * @param events The current event group received by the correlator | |
29 | * @return true if the group is ready for aggregation | |
30 | */ | |
31 | public boolean shouldAggregateEvents(EventGroup events); | |
32 | ||
33 | /** | |
34 | * This method is invoked if the shouldAggregate method is called and returns | |
35 | * true. Once this method returns an aggregated message, the event group is | |
36 | * removed from the router. | |
37 | * | |
38 | * @param events the event group for this request | |
39 | * @return an aggregated message | |
40 | * @throws AggregationException if the aggregation fails. in this scenario the | |
41 | * whole event group is removed and passed to the exception handler | |
42 | * for this component | |
43 | */ | |
44 | public MuleMessage aggregateEvents(EventGroup events) throws RoutingException; | |
45 | ||
46 | ||
47 | /** | |
48 | * Creates the event group with a specific correlation size based on the Mule | |
49 | * Correlation support | |
50 | * | |
51 | * @param id The group id | |
52 | * @param event the current event | |
53 | * @return a new event group of a fixed size | |
54 | */ | |
55 | public EventGroup createEventGroup(MuleEvent event, Object id); | |
56 | } |