public class JdbcAggregationRepository
extends org.apache.camel.support.ServiceSupport
implements org.apache.camel.spi.RecoverableAggregationRepository, org.apache.camel.spi.OptimisticLockingAggregationRepository
AggregationRepository
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
|
protected 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 final 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.OptimisticLockingAggregationRepository
org.apache.camel.spi.OptimisticLockingAggregationRepository.OptimisticLockingException
public org.apache.camel.Exchange add(org.apache.camel.CamelContext camelContext, String correlationId, org.apache.camel.Exchange exchange)
add
in interface org.apache.camel.spi.AggregationRepository
protected 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 tableException
protected 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 exchangerepositoryName
- The name of the tableException
protected int insertAndUpdateHelper(org.apache.camel.CamelContext camelContext, String key, org.apache.camel.Exchange exchange, String sql, boolean idComesFirst) throws Exception
Exception
public org.apache.camel.Exchange get(org.apache.camel.CamelContext camelContext, String correlationId)
get
in interface org.apache.camel.spi.AggregationRepository
public void remove(org.apache.camel.CamelContext camelContext, String correlationId, org.apache.camel.Exchange exchange)
remove
in interface org.apache.camel.spi.AggregationRepository
remove
in interface org.apache.camel.spi.OptimisticLockingAggregationRepository
public void confirm(org.apache.camel.CamelContext camelContext, String exchangeId)
confirm
in interface org.apache.camel.spi.AggregationRepository
public Set<String> getKeys()
getKeys
in interface org.apache.camel.spi.AggregationRepository
public Set<String> scan(org.apache.camel.CamelContext camelContext)
scan
in interface org.apache.camel.spi.RecoverableAggregationRepository
protected 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.RecoverableAggregationRepository
public void setRecoveryInterval(long interval, TimeUnit timeUnit)
setRecoveryInterval
in interface org.apache.camel.spi.RecoverableAggregationRepository
public void setRecoveryInterval(long interval)
setRecoveryInterval
in interface org.apache.camel.spi.RecoverableAggregationRepository
public long getRecoveryIntervalInMillis()
getRecoveryIntervalInMillis
in interface org.apache.camel.spi.RecoverableAggregationRepository
public boolean isUseRecovery()
isUseRecovery
in interface org.apache.camel.spi.RecoverableAggregationRepository
public void setUseRecovery(boolean useRecovery)
setUseRecovery
in interface org.apache.camel.spi.RecoverableAggregationRepository
public int getMaximumRedeliveries()
getMaximumRedeliveries
in interface org.apache.camel.spi.RecoverableAggregationRepository
public void setMaximumRedeliveries(int maximumRedeliveries)
setMaximumRedeliveries
in interface org.apache.camel.spi.RecoverableAggregationRepository
public String getDeadLetterUri()
getDeadLetterUri
in interface org.apache.camel.spi.RecoverableAggregationRepository
public void setDeadLetterUri(String deadLetterUri)
setDeadLetterUri
in interface org.apache.camel.spi.RecoverableAggregationRepository
public 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.ServiceSupport
Exception
Apache Camel