org.apache.camel.processor.aggregate
Class MemoryAggregationRepository

java.lang.Object
  extended by org.apache.camel.support.ServiceSupport
      extended by org.apache.camel.processor.aggregate.MemoryAggregationRepository
All Implemented Interfaces:
Service, ShutdownableService, AggregationRepository, StatefulService, SuspendableService

public class MemoryAggregationRepository
extends ServiceSupport
implements AggregationRepository

A memory based AggregationRepository which stores in memory only.

Version:

Field Summary
 
Fields inherited from class org.apache.camel.support.ServiceSupport
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending
 
Constructor Summary
MemoryAggregationRepository()
           
 
Method Summary
 Exchange add(CamelContext camelContext, String key, Exchange exchange)
          Add the given Exchange under the correlation key.
 void confirm(CamelContext camelContext, String exchangeId)
          Confirms the completion of the Exchange.
protected  void doStart()
          Implementations override this method to support customized start/stop.
protected  void doStop()
          Implementations override this method to support customized start/stop.
 Exchange get(CamelContext camelContext, String key)
          Gets the given exchange with the correlation key
 Set<String> getKeys()
          Gets the keys currently in the repository.
 void remove(CamelContext camelContext, String key, Exchange exchange)
          Removes the exchange with the given correlation key, which should happen when an Exchange is completed
 
Methods inherited from class org.apache.camel.support.ServiceSupport
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspended, isSuspending, resume, shutdown, start, stop, suspend
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemoryAggregationRepository

public MemoryAggregationRepository()
Method Detail

add

public Exchange add(CamelContext camelContext,
                    String key,
                    Exchange exchange)
Description copied from interface: AggregationRepository
Add the given Exchange under the correlation key.

Will replace any existing exchange.

Specified by:
add in interface AggregationRepository
Parameters:
camelContext - the current CamelContext
key - the correlation key
exchange - the aggregated exchange
Returns:
the old exchange if any existed

get

public Exchange get(CamelContext camelContext,
                    String key)
Description copied from interface: AggregationRepository
Gets the given exchange with the correlation key

Specified by:
get in interface AggregationRepository
Parameters:
camelContext - the current CamelContext
key - the correlation key
Returns:
the exchange, or null if no exchange was previously added

remove

public void remove(CamelContext camelContext,
                   String key,
                   Exchange exchange)
Description copied from interface: AggregationRepository
Removes the exchange with the given correlation key, which should happen when an Exchange is completed

Specified by:
remove in interface AggregationRepository
Parameters:
camelContext - the current CamelContext
key - the correlation key
exchange - the exchange to remove

confirm

public void confirm(CamelContext camelContext,
                    String exchangeId)
Description copied from interface: AggregationRepository
Confirms the completion of the Exchange.

Specified by:
confirm in interface AggregationRepository
Parameters:
camelContext - the current CamelContext
exchangeId - exchange id to confirm

getKeys

public Set<String> getKeys()
Description copied from interface: AggregationRepository
Gets the keys currently in the repository.

Specified by:
getKeys in interface AggregationRepository
Returns:
the keys

doStart

protected void doStart()
                throws Exception
Description copied from class: ServiceSupport
Implementations override this method to support customized start/stop.

Important: See ServiceSupport.doStop() for more details.

Specified by:
doStart in class ServiceSupport
Throws:
Exception
See Also:
ServiceSupport.doStop()

doStop

protected void doStop()
               throws Exception
Description copied from class: ServiceSupport
Implementations override this method to support customized start/stop.

Important: Camel will invoke this ServiceSupport.doStop() method when the service is being stopped. This method will also be invoked if the service is still in uninitialized state (eg has not been started). The method is always called to allow the service to do custom logic when the service is being stopped, such as when CamelContext is shutting down.

Specified by:
doStop in class ServiceSupport
Throws:
Exception
See Also:
ServiceSupport.doStart()


Apache CAMEL