org.apache.camel.processor.aggregate.jdbc
Class JdbcAggregationRepository

java.lang.Object
  extended by org.apache.camel.support.ServiceSupport
      extended by org.apache.camel.processor.aggregate.jdbc.JdbcAggregationRepository
All Implemented Interfaces:
org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.AggregationRepository, org.apache.camel.spi.OptimisticLockingAggregationRepository, org.apache.camel.spi.RecoverableAggregationRepository, org.apache.camel.StatefulService, org.apache.camel.SuspendableService

public class JdbcAggregationRepository
extends org.apache.camel.support.ServiceSupport
implements org.apache.camel.spi.RecoverableAggregationRepository, org.apache.camel.spi.OptimisticLockingAggregationRepository

JDBC based AggregationRepository


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.camel.spi.OptimisticLockingAggregationRepository
org.apache.camel.spi.OptimisticLockingAggregationRepository.OptimisticLockingException
 
Field Summary
 
Fields inherited from class org.apache.camel.support.ServiceSupport
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending
 
Constructor Summary
JdbcAggregationRepository()
          Creates an aggregation repository
JdbcAggregationRepository(org.springframework.transaction.PlatformTransactionManager transactionManager, String repositoryName, DataSource dataSource)
          Creates an aggregation repository with the three mandatory parameters
 
Method Summary
 org.apache.camel.Exchange add(org.apache.camel.CamelContext camelContext, String correlationId, org.apache.camel.Exchange exchange)
           
 org.apache.camel.Exchange add(org.apache.camel.CamelContext camelContext, String correlationId, org.apache.camel.Exchange oldExchange, org.apache.camel.Exchange newExchange)
           
 void confirm(org.apache.camel.CamelContext camelContext, String exchangeId)
           
protected  void doStart()
           
protected  void doStop()
           
 org.apache.camel.Exchange get(org.apache.camel.CamelContext camelContext, String correlationId)
           
 String getDeadLetterUri()
           
 JdbcOptimisticLockingExceptionMapper getJdbcOptimisticLockingExceptionMapper()
           
 Set<String> getKeys()
           
protected  Set<String> getKeys(String repositoryName)
          Returns the keys in the given repository
 org.springframework.jdbc.support.lob.LobHandler getLobHandler()
           
 int getMaximumRedeliveries()
           
 long getRecoveryIntervalInMillis()
           
 String getRepositoryName()
           
 String getRepositoryNameCompleted()
           
 boolean hasHeadersToStoreAsText()
           
protected  void insert(org.apache.camel.CamelContext camelContext, String correlationId, org.apache.camel.Exchange exchange, String repositoryName)
          Inserts a new record into the given repository table
protected  void insertAndUpdateHelper(org.apache.camel.CamelContext camelContext, String key, org.apache.camel.Exchange exchange, String sql, boolean idComesFirst)
           
 boolean isReturnOldExchange()
           
 boolean isUseRecovery()
           
 org.apache.camel.Exchange recover(org.apache.camel.CamelContext camelContext, String exchangeId)
           
 void remove(org.apache.camel.CamelContext camelContext, String correlationId, org.apache.camel.Exchange exchange)
           
 Set<String> scan(org.apache.camel.CamelContext camelContext)
           
 void setDataSource(DataSource dataSource)
           
 void setDeadLetterUri(String deadLetterUri)
           
 void setHeadersToStoreAsText(List<String> headersToStoreAsText)
           
 void setJdbcCamelCodec(JdbcCamelCodec codec)
           
 void setJdbcOptimisticLockingExceptionMapper(JdbcOptimisticLockingExceptionMapper jdbcOptimisticLockingExceptionMapper)
           
 void setLobHandler(org.springframework.jdbc.support.lob.LobHandler lobHandler)
           
 void setMaximumRedeliveries(int maximumRedeliveries)
           
 void setRecoveryInterval(long interval)
           
 void setRecoveryInterval(long interval, TimeUnit timeUnit)
           
 void setRepositoryName(String repositoryName)
           
 void setReturnOldExchange(boolean returnOldExchange)
           
 void setStoreBodyAsText(boolean storeBodyAsText)
           
 void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
           
 void setUseRecovery(boolean useRecovery)
           
protected  void update(org.apache.camel.CamelContext camelContext, String key, org.apache.camel.Exchange exchange, String repositoryName)
          Updates the current exchange details in the given repository table
 
Methods inherited from class org.apache.camel.support.ServiceSupport
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, 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

JdbcAggregationRepository

public JdbcAggregationRepository()
Creates an aggregation repository


JdbcAggregationRepository

public JdbcAggregationRepository(org.springframework.transaction.PlatformTransactionManager transactionManager,
                                 String repositoryName,
                                 DataSource dataSource)
Creates an aggregation repository with the three mandatory parameters

Method Detail

setRepositoryName

public final void setRepositoryName(String repositoryName)
Parameters:
repositoryName - the repositoryName to set

setTransactionManager

public final void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)

setDataSource

public final void setDataSource(DataSource dataSource)

add

public org.apache.camel.Exchange add(org.apache.camel.CamelContext camelContext,
                                     String correlationId,
                                     org.apache.camel.Exchange oldExchange,
                                     org.apache.camel.Exchange newExchange)
                              throws org.apache.camel.spi.OptimisticLockingAggregationRepository.OptimisticLockingException
Specified by:
add in interface org.apache.camel.spi.OptimisticLockingAggregationRepository
Throws:
org.apache.camel.spi.OptimisticLockingAggregationRepository.OptimisticLockingException

add

public org.apache.camel.Exchange add(org.apache.camel.CamelContext camelContext,
                                     String correlationId,
                                     org.apache.camel.Exchange exchange)
Specified by:
add in interface org.apache.camel.spi.AggregationRepository

update

protected void update(org.apache.camel.CamelContext camelContext,
                      String key,
                      org.apache.camel.Exchange exchange,
                      String repositoryName)
               throws Exception
Updates the current exchange details in the given repository table

Parameters:
camelContext - the current CamelContext
key - the correlation key
exchange - the aggregated exchange
repositoryName - The name of the table
Throws:
Exception

insert

protected void insert(org.apache.camel.CamelContext camelContext,
                      String correlationId,
                      org.apache.camel.Exchange exchange,
                      String repositoryName)
               throws Exception
Inserts a new record into the given repository table

Parameters:
camelContext - the current CamelContext
correlationId - the correlation key
exchange - the aggregated exchange
repositoryName - The name of the table
Throws:
Exception

insertAndUpdateHelper

protected void insertAndUpdateHelper(org.apache.camel.CamelContext camelContext,
                                     String key,
                                     org.apache.camel.Exchange exchange,
                                     String sql,
                                     boolean idComesFirst)
                              throws Exception
Throws:
Exception

get

public org.apache.camel.Exchange get(org.apache.camel.CamelContext camelContext,
                                     String correlationId)
Specified by:
get in interface org.apache.camel.spi.AggregationRepository

remove

public void remove(org.apache.camel.CamelContext camelContext,
                   String correlationId,
                   org.apache.camel.Exchange exchange)
Specified by:
remove in interface org.apache.camel.spi.AggregationRepository
Specified by:
remove in interface org.apache.camel.spi.OptimisticLockingAggregationRepository

confirm

public void confirm(org.apache.camel.CamelContext camelContext,
                    String exchangeId)
Specified by:
confirm in interface org.apache.camel.spi.AggregationRepository

getKeys

public Set<String> getKeys()
Specified by:
getKeys in interface org.apache.camel.spi.AggregationRepository

scan

public Set<String> scan(org.apache.camel.CamelContext camelContext)
Specified by:
scan in interface org.apache.camel.spi.RecoverableAggregationRepository

getKeys

protected Set<String> getKeys(String repositoryName)
Returns the keys in the given repository

Parameters:
repositoryName - The name of the table
Returns:
Set of keys in the given repository name

recover

public org.apache.camel.Exchange recover(org.apache.camel.CamelContext camelContext,
                                         String exchangeId)
Specified by:
recover in interface org.apache.camel.spi.RecoverableAggregationRepository

setRecoveryInterval

public void setRecoveryInterval(long interval,
                                TimeUnit timeUnit)
Specified by:
setRecoveryInterval in interface org.apache.camel.spi.RecoverableAggregationRepository

setRecoveryInterval

public void setRecoveryInterval(long interval)
Specified by:
setRecoveryInterval in interface org.apache.camel.spi.RecoverableAggregationRepository

getRecoveryIntervalInMillis

public long getRecoveryIntervalInMillis()
Specified by:
getRecoveryIntervalInMillis in interface org.apache.camel.spi.RecoverableAggregationRepository

isUseRecovery

public boolean isUseRecovery()
Specified by:
isUseRecovery in interface org.apache.camel.spi.RecoverableAggregationRepository

setUseRecovery

public void setUseRecovery(boolean useRecovery)
Specified by:
setUseRecovery in interface org.apache.camel.spi.RecoverableAggregationRepository

getMaximumRedeliveries

public int getMaximumRedeliveries()
Specified by:
getMaximumRedeliveries in interface org.apache.camel.spi.RecoverableAggregationRepository

setMaximumRedeliveries

public void setMaximumRedeliveries(int maximumRedeliveries)
Specified by:
setMaximumRedeliveries in interface org.apache.camel.spi.RecoverableAggregationRepository

getDeadLetterUri

public String getDeadLetterUri()
Specified by:
getDeadLetterUri in interface org.apache.camel.spi.RecoverableAggregationRepository

setDeadLetterUri

public void setDeadLetterUri(String deadLetterUri)
Specified by:
setDeadLetterUri in interface org.apache.camel.spi.RecoverableAggregationRepository

isReturnOldExchange

public boolean isReturnOldExchange()

setReturnOldExchange

public void setReturnOldExchange(boolean returnOldExchange)

setJdbcCamelCodec

public void setJdbcCamelCodec(JdbcCamelCodec codec)

hasHeadersToStoreAsText

public boolean hasHeadersToStoreAsText()

setHeadersToStoreAsText

public void setHeadersToStoreAsText(List<String> headersToStoreAsText)

setStoreBodyAsText

public void setStoreBodyAsText(boolean storeBodyAsText)

getLobHandler

public org.springframework.jdbc.support.lob.LobHandler getLobHandler()
Returns:
the lobHandler

setLobHandler

public void setLobHandler(org.springframework.jdbc.support.lob.LobHandler lobHandler)
Parameters:
lobHandler - the lobHandler to set

getJdbcOptimisticLockingExceptionMapper

public JdbcOptimisticLockingExceptionMapper getJdbcOptimisticLockingExceptionMapper()

setJdbcOptimisticLockingExceptionMapper

public void setJdbcOptimisticLockingExceptionMapper(JdbcOptimisticLockingExceptionMapper jdbcOptimisticLockingExceptionMapper)

getRepositoryName

public String getRepositoryName()

getRepositoryNameCompleted

public String getRepositoryNameCompleted()

doStart

protected void doStart()
                throws Exception
Specified by:
doStart in class org.apache.camel.support.ServiceSupport
Throws:
Exception

doStop

protected void doStop()
               throws Exception
Specified by:
doStop in class org.apache.camel.support.ServiceSupport
Throws:
Exception


Apache Camel