public class JdbcAggregationRepository
extends org.apache.camel.support.service.ServiceSupport
implements org.apache.camel.spi.RecoverableAggregationRepository, org.apache.camel.spi.OptimisticLockingAggregationRepository
AggregationRepository
JdbcAggregationRepository will only preserve any Serializable compatible
data types. If a data type is not such a type its dropped and a WARN is
logged. And it only persists the Message body and the Message headers.
The Exchange properties are not persisted.| Modifier and Type | Field and Description |
|---|---|
protected static String |
BODY |
protected static String |
EXCHANGE |
protected static String |
ID |
| Constructor and Description |
|---|
JdbcAggregationRepository()
Creates an aggregation repository
|
JdbcAggregationRepository(org.springframework.transaction.PlatformTransactionManager transactionManager,
String repositoryName,
DataSource dataSource)
Creates an aggregation repository with the three mandatory parameters
|
| Modifier and Type | Method and Description |
|---|---|
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() |
List<String> |
getHeadersToStoreAsText() |
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() |
int |
getPropagationBehavior() |
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 int |
insertAndUpdateHelper(org.apache.camel.CamelContext camelContext,
String key,
org.apache.camel.Exchange exchange,
String sql,
boolean idComesFirst) |
boolean |
isAllowSerializedHeaders() |
boolean |
isReturnOldExchange() |
boolean |
isStoreBodyAsText() |
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 |
setAllowSerializedHeaders(boolean allowSerializedHeaders) |
void |
setDataSource(DataSource dataSource)
Sets the DataSource to use for accessing the database
|
void |
setDeadLetterUri(String deadLetterUri)
An endpoint uri for a Dead Letter Channel where exhausted recovered Exchanges will be
moved.
|
void |
setHeadersToStoreAsText(List<String> headersToStoreAsText)
Allows to store headers as String which is human readable.
|
void |
setJdbcCamelCodec(JdbcCamelCodec codec) |
void |
setJdbcOptimisticLockingExceptionMapper(JdbcOptimisticLockingExceptionMapper jdbcOptimisticLockingExceptionMapper) |
void |
setLobHandler(org.springframework.jdbc.support.lob.LobHandler lobHandler)
Sets a custom LobHandler to use
|
void |
setMaximumRedeliveries(int maximumRedeliveries) |
void |
setPropagationBehavior(int propagationBehavior)
Sets propagation behavior to use with spring transaction templates which are used for database access.
|
void |
setPropagationBehaviorName(String propagationBehaviorName)
Sets propagation behavior to use with spring transaction templates which are used for database access.
|
void |
setRecoveryInterval(long interval) |
void |
setRecoveryInterval(long interval,
TimeUnit timeUnit)
If recovery is enabled then a background task is run every x'th time to scan for failed exchanges to recover
and resubmit.
|
void |
setRepositoryName(String repositoryName)
Sets the name of the repository
|
void |
setReturnOldExchange(boolean returnOldExchange)
Whether the get operation should return the old existing Exchange if any existed.
|
void |
setStoreBodyAsText(boolean storeBodyAsText)
Whether to store the message body as String which is human readable.
|
void |
setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager) |
void |
setUseRecovery(boolean useRecovery)
Whether or not recovery is enabled.
|
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
|
build, doBuild, doInit, doResume, doShutdown, doSuspend, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendprotected static final String EXCHANGE
protected static final String ID
protected static final String BODY
public JdbcAggregationRepository()
public JdbcAggregationRepository(org.springframework.transaction.PlatformTransactionManager transactionManager,
String repositoryName,
DataSource dataSource)
public final void setRepositoryName(String repositoryName)
public final void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
public void setDataSource(DataSource dataSource)
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
add in interface org.apache.camel.spi.OptimisticLockingAggregationRepositoryorg.apache.camel.spi.OptimisticLockingAggregationRepository.OptimisticLockingExceptionpublic org.apache.camel.Exchange add(org.apache.camel.CamelContext camelContext,
String correlationId,
org.apache.camel.Exchange exchange)
add in interface org.apache.camel.spi.AggregationRepositoryprotected void update(org.apache.camel.CamelContext camelContext,
String key,
org.apache.camel.Exchange exchange,
String repositoryName)
throws Exception
camelContext - the current CamelContextkey - the correlation keyexchange - the aggregated exchangerepositoryName - The name of the tableExceptionprotected void insert(org.apache.camel.CamelContext camelContext,
String correlationId,
org.apache.camel.Exchange exchange,
String repositoryName)
throws Exception
camelContext - the current CamelContextcorrelationId - the correlation keyexchange - the aggregated exchange to insert. The headers will be persisted but not the properties.repositoryName - The name of the tableExceptionprotected int insertAndUpdateHelper(org.apache.camel.CamelContext camelContext,
String key,
org.apache.camel.Exchange exchange,
String sql,
boolean idComesFirst)
throws Exception
Exceptionpublic org.apache.camel.Exchange get(org.apache.camel.CamelContext camelContext,
String correlationId)
get in interface org.apache.camel.spi.AggregationRepositorypublic void remove(org.apache.camel.CamelContext camelContext,
String correlationId,
org.apache.camel.Exchange exchange)
remove in interface org.apache.camel.spi.AggregationRepositoryremove in interface org.apache.camel.spi.OptimisticLockingAggregationRepositorypublic void confirm(org.apache.camel.CamelContext camelContext,
String exchangeId)
confirm in interface org.apache.camel.spi.AggregationRepositorypublic Set<String> getKeys()
getKeys in interface org.apache.camel.spi.AggregationRepositorypublic Set<String> scan(org.apache.camel.CamelContext camelContext)
scan in interface org.apache.camel.spi.RecoverableAggregationRepositoryprotected Set<String> getKeys(String repositoryName)
repositoryName - The name of the tablepublic org.apache.camel.Exchange recover(org.apache.camel.CamelContext camelContext,
String exchangeId)
recover in interface org.apache.camel.spi.RecoverableAggregationRepositorypublic void setRecoveryInterval(long interval,
TimeUnit timeUnit)
setRecoveryInterval in interface org.apache.camel.spi.RecoverableAggregationRepositorypublic void setRecoveryInterval(long interval)
setRecoveryInterval in interface org.apache.camel.spi.RecoverableAggregationRepositorypublic long getRecoveryIntervalInMillis()
getRecoveryIntervalInMillis in interface org.apache.camel.spi.RecoverableAggregationRepositorypublic boolean isUseRecovery()
isUseRecovery in interface org.apache.camel.spi.RecoverableAggregationRepositorypublic void setUseRecovery(boolean useRecovery)
setUseRecovery in interface org.apache.camel.spi.RecoverableAggregationRepositorypublic int getMaximumRedeliveries()
getMaximumRedeliveries in interface org.apache.camel.spi.RecoverableAggregationRepositorypublic void setMaximumRedeliveries(int maximumRedeliveries)
setMaximumRedeliveries in interface org.apache.camel.spi.RecoverableAggregationRepositorypublic String getDeadLetterUri()
getDeadLetterUri in interface org.apache.camel.spi.RecoverableAggregationRepositorypublic void setDeadLetterUri(String deadLetterUri)
setDeadLetterUri in interface org.apache.camel.spi.RecoverableAggregationRepositorypublic boolean isReturnOldExchange()
public void setReturnOldExchange(boolean returnOldExchange)
public void setJdbcCamelCodec(JdbcCamelCodec codec)
public boolean hasHeadersToStoreAsText()
public void setHeadersToStoreAsText(List<String> headersToStoreAsText)
headersToStoreAsText - the list of headers to store as Stringpublic boolean isStoreBodyAsText()
public void setStoreBodyAsText(boolean storeBodyAsText)
public boolean isAllowSerializedHeaders()
public void setAllowSerializedHeaders(boolean allowSerializedHeaders)
public int getPropagationBehavior()
public void setPropagationBehavior(int propagationBehavior)
public void setPropagationBehaviorName(String propagationBehaviorName)
propagationBehaviorName - public org.springframework.jdbc.support.lob.LobHandler getLobHandler()
public void setLobHandler(org.springframework.jdbc.support.lob.LobHandler lobHandler)
public JdbcOptimisticLockingExceptionMapper getJdbcOptimisticLockingExceptionMapper()
public void setJdbcOptimisticLockingExceptionMapper(JdbcOptimisticLockingExceptionMapper jdbcOptimisticLockingExceptionMapper)
public String getRepositoryName()
public String getRepositoryNameCompleted()
protected void doStart()
throws Exception
doStart in class org.apache.camel.support.service.ServiceSupportExceptionApache Camel