Coverage Report - org.mule.routing.correlation.EventCorrelatorCallback
 
Classes in this File Line Coverage Branch Coverage Complexity
EventCorrelatorCallback
N/A
N/A
1
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.routing.correlation;
 8  
 
 9  
 import org.mule.api.MuleEvent;
 10  
 import org.mule.api.routing.RoutingException;
 11  
 import org.mule.routing.AggregationException;
 12  
 import org.mule.routing.EventGroup;
 13  
 
 14  
 /**
 15  
  * A callback used to allow pluggable behaviour when correlating events
 16  
  */
 17  
 public interface EventCorrelatorCallback
 18  
 {
 19  
     /**
 20  
      * Determines if the event group is ready to be aggregated. if the group is ready
 21  
      * to be aggregated (this is entirely up to the application. it could be
 22  
      * determined by volume, last modified time or some oher criteria based on the
 23  
      * last event received).
 24  
      *
 25  
      * @param events The current event group received by the correlator
 26  
      * @return true if the group is ready for aggregation
 27  
      */
 28  
     public boolean shouldAggregateEvents(EventGroup events);
 29  
 
 30  
     /**
 31  
      * This method is invoked if the shouldAggregate method is called and returns
 32  
      * true. Once this method returns an aggregated message, the event group is
 33  
      * removed from the router.
 34  
      *
 35  
      * @param events the event group for this request
 36  
      * @return an aggregated message
 37  
      * @throws AggregationException if the aggregation fails. in this scenario the
 38  
      *                              whole event group is removed and passed to the exception handler
 39  
      *                              for this component
 40  
      */
 41  
     public MuleEvent aggregateEvents(EventGroup events) throws RoutingException;
 42  
 
 43  
 
 44  
     /**
 45  
      * Creates the event group with a specific correlation size based on the Mule
 46  
      * Correlation support
 47  
      *
 48  
      * @param id    The group id
 49  
      * @param event the current event
 50  
      * @return a new event group of a fixed size
 51  
      */
 52  
     public EventGroup createEventGroup(MuleEvent event, Object id);
 53  
 }