org.mule.routing.response
Class SingleResponseWithCallbackCorrelator

java.lang.Object
  extended by org.mule.routing.response.SingleResponseWithCallbackCorrelator
All Implemented Interfaces:
EventCorrelatorCallback

public class SingleResponseWithCallbackCorrelator
extends Object
implements EventCorrelatorCallback

A Correlator that correlates one message at a time, esscentially a RPC callback. This callback allows the user to set a callback method on the service component that recieves the message. Any changes made in the callback method will be sent back to the client that initiated the request.


Field Summary
protected  String callback
           
protected  Log logger
          logger used by this class
 
Constructor Summary
SingleResponseWithCallbackCorrelator(String callbackMethod)
           
 
Method Summary
 MuleMessage aggregateEvents(EventGroup events)
          The SingleResponseRouter will always return the first event of an event group.
 EventGroup createEventGroup(MuleEvent event, Object id)
          Creates the event group with a specific correlation size based on the Mule Correlation support
 boolean shouldAggregateEvents(EventGroup events)
          The SingleResponseRouter will return true if the event group size is 1.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final transient Log logger
logger used by this class


callback

protected String callback
Constructor Detail

SingleResponseWithCallbackCorrelator

public SingleResponseWithCallbackCorrelator(String callbackMethod)
Method Detail

shouldAggregateEvents

public boolean shouldAggregateEvents(EventGroup events)
The SingleResponseRouter will return true if the event group size is 1. If the group size is greater than 1, a warning will be logged.

Specified by:
shouldAggregateEvents in interface EventCorrelatorCallback
Parameters:
events - event group to consider
Returns:
true if the event group size is 1 or greater
See Also:
org.mule.routing.EventCorrelatorCallback#shouldAggregateEvents(EventGroup)}

aggregateEvents

public MuleMessage aggregateEvents(EventGroup events)
                            throws RoutingException
The SingleResponseRouter will always return the first event of an event group.

Specified by:
aggregateEvents in interface EventCorrelatorCallback
Parameters:
events - the event group for this request
Returns:
an aggregated message
Throws:
RoutingException - if the aggregation fails. In this scenario the whole event group is removed and passed to the exception handler for this component.
AggregationException - if the aggregation fails. in this scenario the whole event group is removed and passed to the exception handler for this component
See Also:
org.mule.routing.response.AbstractResponseAggregator#aggregateEvents(EventGroup)}

createEventGroup

public EventGroup createEventGroup(MuleEvent event,
                                   Object id)
Description copied from interface: EventCorrelatorCallback
Creates the event group with a specific correlation size based on the Mule Correlation support

Specified by:
createEventGroup in interface EventCorrelatorCallback
Parameters:
event - the current event
id - The group id
Returns:
a new event group of a fixed size


Copyright © 2003-2010 MuleSoft, Inc.. All Rights Reserved.