org.apache.camel.component.hawtdb
Class HawtDBAggregationRepository

java.lang.Object
  extended by org.apache.camel.impl.ServiceSupport
      extended by org.apache.camel.component.hawtdb.HawtDBAggregationRepository
All Implemented Interfaces:
Service, ShutdownableService, AggregationRepository, RecoverableAggregationRepository

public class HawtDBAggregationRepository
extends ServiceSupport
implements RecoverableAggregationRepository

An instance of AggregationRepository which is backed by a HawtDB.


Constructor Summary
HawtDBAggregationRepository()
          Creates an aggregation repository
HawtDBAggregationRepository(String repositoryName)
          Creates an aggregation repository
HawtDBAggregationRepository(String repositoryName, HawtDBFile hawtDBFile)
          Creates an aggregation repository using the provided HawtDBFile.
HawtDBAggregationRepository(String repositoryName, String persistentFileName)
          Creates an aggregation repository using a new HawtDBFile that persists using the provided file.
 
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()
           
protected  void doStop()
           
 Exchange get(CamelContext camelContext, String key)
          Gets the given exchange with the correlation key
 Integer getBufferSize()
           
 String getDeadLetterUri()
          Gets the dead letter channel
 HawtDBFile getHawtDBFile()
           
 Set<String> getKeys()
          Gets the keys currently in the repository.
 int getMaximumRedeliveries()
          Gets the maximum redelivery attempts to do before a recovered Exchange is doomed as exhausted and moved to the dead letter channel.
 short getPageSize()
           
 String getPersistentFileName()
           
 long getRecoveryIntervalInMillis()
          Gets the interval between recovery scans in millis.
 String getRepositoryName()
           
 boolean isReturnOldExchange()
           
 boolean isSync()
           
 boolean isUseRecovery()
          Whether or not recovery is enabled or not
 Exchange recover(CamelContext camelContext, String exchangeId)
          Recovers the exchange with the given exchange id
 void remove(CamelContext camelContext, String key, Exchange exchange)
          Removes the exchange with the given correlation key, which should happen when an Exchange is completed
 Set<String> scan(CamelContext camelContext)
          Scans the repository for Exchanges to be recovered
 void setBufferSize(Integer bufferSize)
           
 void setDeadLetterUri(String deadLetterUri)
          Sets an optional dead letter channel which exhausted recovered Exchange should be send to.
 void setHawtDBFile(HawtDBFile hawtDBFile)
           
 void setMaximumRedeliveries(int maximumRedeliveries)
          Sets an optional limit of the number of redelivery attempt of recovered Exchange should be attempted, before its exhausted.
 void setPageSize(short pageSize)
           
 void setPersistentFileName(String persistentFileName)
           
 void setRecoveryInterval(long interval)
          Sets the interval between recovery scans
 void setRecoveryInterval(long interval, TimeUnit timeUnit)
          Sets the interval between recovery scans
 void setRepositoryName(String repositoryName)
           
 void setReturnOldExchange(boolean returnOldExchange)
           
 void setSync(boolean sync)
           
 void setUseRecovery(boolean useRecovery)
          Sets whether or not recovery is enabled
 
Methods inherited from class org.apache.camel.impl.ServiceSupport
addChildService, doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspended, isSuspending, removeChildService, resume, shutdown, start, start, stop, suspend
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HawtDBAggregationRepository

public HawtDBAggregationRepository()
Creates an aggregation repository


HawtDBAggregationRepository

public HawtDBAggregationRepository(String repositoryName)
Creates an aggregation repository

Parameters:
repositoryName - the repository name

HawtDBAggregationRepository

public HawtDBAggregationRepository(String repositoryName,
                                   String persistentFileName)
Creates an aggregation repository using a new HawtDBFile that persists using the provided file.

Parameters:
repositoryName - the repository name
persistentFileName - the persistent store filename

HawtDBAggregationRepository

public HawtDBAggregationRepository(String repositoryName,
                                   HawtDBFile hawtDBFile)
Creates an aggregation repository using the provided HawtDBFile.

Parameters:
repositoryName - the repository name
hawtDBFile - the hawtdb file to use as persistent store
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

scan

public Set<String> scan(CamelContext camelContext)
Description copied from interface: RecoverableAggregationRepository
Scans the repository for Exchanges to be recovered

Specified by:
scan in interface RecoverableAggregationRepository
Parameters:
camelContext - the current CamelContext
Returns:
the exchange ids for to be recovered

recover

public Exchange recover(CamelContext camelContext,
                        String exchangeId)
Description copied from interface: RecoverableAggregationRepository
Recovers the exchange with the given exchange id

Specified by:
recover in interface RecoverableAggregationRepository
Parameters:
camelContext - the current CamelContext
exchangeId - exchange id
Returns:
the recovered exchange or null if not found

getHawtDBFile

public HawtDBFile getHawtDBFile()

setHawtDBFile

public void setHawtDBFile(HawtDBFile hawtDBFile)

getRepositoryName

public String getRepositoryName()

setRepositoryName

public void setRepositoryName(String repositoryName)

getPersistentFileName

public String getPersistentFileName()

setPersistentFileName

public void setPersistentFileName(String persistentFileName)

isSync

public boolean isSync()

setSync

public void setSync(boolean sync)

getBufferSize

public Integer getBufferSize()

setBufferSize

public void setBufferSize(Integer bufferSize)

isReturnOldExchange

public boolean isReturnOldExchange()

setReturnOldExchange

public void setReturnOldExchange(boolean returnOldExchange)

setRecoveryInterval

public void setRecoveryInterval(long interval,
                                TimeUnit timeUnit)
Description copied from interface: RecoverableAggregationRepository
Sets the interval between recovery scans

Specified by:
setRecoveryInterval in interface RecoverableAggregationRepository
Parameters:
interval - the interval
timeUnit - the time unit

setRecoveryInterval

public void setRecoveryInterval(long interval)
Description copied from interface: RecoverableAggregationRepository
Sets the interval between recovery scans

Specified by:
setRecoveryInterval in interface RecoverableAggregationRepository
Parameters:
interval - the interval in millis

getRecoveryIntervalInMillis

public long getRecoveryIntervalInMillis()
Description copied from interface: RecoverableAggregationRepository
Gets the interval between recovery scans in millis.

Specified by:
getRecoveryIntervalInMillis in interface RecoverableAggregationRepository
Returns:
the interval in millis

isUseRecovery

public boolean isUseRecovery()
Description copied from interface: RecoverableAggregationRepository
Whether or not recovery is enabled or not

Specified by:
isUseRecovery in interface RecoverableAggregationRepository
Returns:
true to use recovery, false otherwise.

setUseRecovery

public void setUseRecovery(boolean useRecovery)
Description copied from interface: RecoverableAggregationRepository
Sets whether or not recovery is enabled

Specified by:
setUseRecovery in interface RecoverableAggregationRepository
Parameters:
useRecovery - whether or not recovery is enabled

getMaximumRedeliveries

public int getMaximumRedeliveries()
Description copied from interface: RecoverableAggregationRepository
Gets the maximum redelivery attempts to do before a recovered Exchange is doomed as exhausted and moved to the dead letter channel.

Specified by:
getMaximumRedeliveries in interface RecoverableAggregationRepository
Returns:
the maximum redeliveries

setMaximumRedeliveries

public void setMaximumRedeliveries(int maximumRedeliveries)
Description copied from interface: RecoverableAggregationRepository
Sets an optional limit of the number of redelivery attempt of recovered Exchange should be attempted, before its exhausted.

When this limit is hit, then the Exchange is moved to the dead letter channel.

By default this option is disabled

Specified by:
setMaximumRedeliveries in interface RecoverableAggregationRepository
Parameters:
maximumRedeliveries - the maximum redeliveries

getDeadLetterUri

public String getDeadLetterUri()
Description copied from interface: RecoverableAggregationRepository
Gets the dead letter channel

Specified by:
getDeadLetterUri in interface RecoverableAggregationRepository
Returns:
the uri of the dead letter channel

setDeadLetterUri

public void setDeadLetterUri(String deadLetterUri)
Description copied from interface: RecoverableAggregationRepository
Sets an optional dead letter channel which exhausted recovered Exchange should be send to.

By default this option is disabled

Specified by:
setDeadLetterUri in interface RecoverableAggregationRepository
Parameters:
deadLetterUri - the uri of the dead letter channel

getPageSize

public short getPageSize()

setPageSize

public void setPageSize(short pageSize)

doStart

protected void doStart()
                throws Exception
Specified by:
doStart in class ServiceSupport
Throws:
Exception

doStop

protected void doStop()
               throws Exception
Specified by:
doStop in class ServiceSupport
Throws:
Exception


Apache CAMEL