Class CassandraAggregationRepository
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.processor.aggregate.cassandra.CassandraAggregationRepository
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.spi.AggregationRepository,org.apache.camel.spi.RecoverableAggregationRepository,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
- Direct Known Subclasses:
NamedCassandraAggregationRepository
public class CassandraAggregationRepository
extends org.apache.camel.support.service.ServiceSupport
implements org.apache.camel.spi.RecoverableAggregationRepository
Implementation of
AggregationRepository using Cassandra table to store exchanges. Advice: use
LeveledCompaction for this table and tune read/write consistency levels. Warning: Cassandra is not the best tool for
queuing use cases See: http://www.datastax.com/dev/blog/cassandra-anti-patterns-queues-and-queue-like-datasets-
Field Summary
Fields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING -
Constructor Summary
ConstructorsConstructorDescriptionCassandraAggregationRepository(com.datastax.oss.driver.api.core.CqlSession session) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.camel.ExchangeInsert or update exchange in aggregation table.voidRemove exchange by Id from aggregation table.protected voiddoStart()protected voiddoStop()org.apache.camel.ExchangeGet exchange from aggregation table by aggregation key.getKeys()Get aggregation exchangeIds from aggregation table.intString[]protected Object[]getPKValues(String key) Generate primary key values from aggregation key.Object[]com.datastax.oss.driver.api.core.ConsistencyLevellongcom.datastax.oss.driver.api.core.CqlSessiongetTable()getTtl()com.datastax.oss.driver.api.core.ConsistencyLevelprotected voidbooleanbooleanorg.apache.camel.ExchangeGet exchange by exchange ID.voidRemove exchange by aggregation key from aggregation table.scan(org.apache.camel.CamelContext camelContext) Get exchange IDs to be recoveredprotected List<com.datastax.oss.driver.api.core.cql.Row> voidsetAllowSerializedHeaders(boolean allowSerializedHeaders) voidsetDeadLetterUri(String deadLetterUri) voidsetExchangeColumn(String exchangeColumnName) voidsetExchangeIdColumn(String exchangeIdColumn) voidsetMaximumRedeliveries(int maximumRedeliveries) voidsetPKColumns(String... pkColumns) voidsetPrefixPKValues(Object... prefixPKValues) voidsetReadConsistencyLevel(com.datastax.oss.driver.api.core.ConsistencyLevel readConsistencyLevel) voidsetRecoveryInterval(long recoveryIntervalInMillis) voidsetRecoveryInterval(long interval, TimeUnit timeUnit) voidsetRecoveryIntervalInMillis(long recoveryIntervalInMillis) voidsetSession(com.datastax.oss.driver.api.core.CqlSession session) voidvoidvoidsetUseRecovery(boolean useRecovery) voidsetWriteConsistencyLevel(com.datastax.oss.driver.api.core.ConsistencyLevel writeConsistencyLevel) Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.camel.spi.RecoverableAggregationRepository
confirmWithResultMethods inherited from interface org.apache.camel.Service
build, close, init, start, stopMethods inherited from interface org.apache.camel.ShutdownableService
shutdownMethods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Constructor Details
-
CassandraAggregationRepository
public CassandraAggregationRepository() -
CassandraAggregationRepository
public CassandraAggregationRepository(com.datastax.oss.driver.api.core.CqlSession session)
-
-
Method Details
-
getPKValues
Generate primary key values from aggregation key. -
doStart
- Overrides:
doStartin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStop
- Overrides:
doStopin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
add
public org.apache.camel.Exchange add(org.apache.camel.CamelContext camelContext, String key, org.apache.camel.Exchange exchange) Insert or update exchange in aggregation table.- Specified by:
addin interfaceorg.apache.camel.spi.AggregationRepository
-
initSelectStatement
protected void initSelectStatement() -
get
Get exchange from aggregation table by aggregation key.- Specified by:
getin interfaceorg.apache.camel.spi.AggregationRepository
-
confirm
Remove exchange by Id from aggregation table.- Specified by:
confirmin interfaceorg.apache.camel.spi.AggregationRepository
-
remove
public void remove(org.apache.camel.CamelContext camelContext, String key, org.apache.camel.Exchange exchange) Remove exchange by aggregation key from aggregation table.- Specified by:
removein interfaceorg.apache.camel.spi.AggregationRepository
-
selectKeyIds
-
getKeys
Get aggregation exchangeIds from aggregation table.- Specified by:
getKeysin interfaceorg.apache.camel.spi.AggregationRepository
-
scan
Get exchange IDs to be recovered- Specified by:
scanin interfaceorg.apache.camel.spi.RecoverableAggregationRepository- Returns:
- Exchange IDs
-
recover
public org.apache.camel.Exchange recover(org.apache.camel.CamelContext camelContext, String exchangeId) Get exchange by exchange ID. This is far from optimal.- Specified by:
recoverin interfaceorg.apache.camel.spi.RecoverableAggregationRepository
-
getSession
public com.datastax.oss.driver.api.core.CqlSession getSession() -
setSession
public void setSession(com.datastax.oss.driver.api.core.CqlSession session) -
getTable
-
setTable
-
getPrefixPKValues
-
setPrefixPKValues
-
getPKColumns
-
setPKColumns
-
getExchangeIdColumn
-
setExchangeIdColumn
-
getWriteConsistencyLevel
public com.datastax.oss.driver.api.core.ConsistencyLevel getWriteConsistencyLevel() -
setWriteConsistencyLevel
public void setWriteConsistencyLevel(com.datastax.oss.driver.api.core.ConsistencyLevel writeConsistencyLevel) -
getReadConsistencyLevel
public com.datastax.oss.driver.api.core.ConsistencyLevel getReadConsistencyLevel() -
setReadConsistencyLevel
public void setReadConsistencyLevel(com.datastax.oss.driver.api.core.ConsistencyLevel readConsistencyLevel) -
getExchangeColumn
-
setExchangeColumn
-
getTtl
-
setTtl
-
getRecoveryIntervalInMillis
public long getRecoveryIntervalInMillis()- Specified by:
getRecoveryIntervalInMillisin interfaceorg.apache.camel.spi.RecoverableAggregationRepository
-
setRecoveryIntervalInMillis
public void setRecoveryIntervalInMillis(long recoveryIntervalInMillis) -
setRecoveryInterval
- Specified by:
setRecoveryIntervalin interfaceorg.apache.camel.spi.RecoverableAggregationRepository
-
setRecoveryInterval
public void setRecoveryInterval(long recoveryIntervalInMillis) - Specified by:
setRecoveryIntervalin interfaceorg.apache.camel.spi.RecoverableAggregationRepository
-
isUseRecovery
public boolean isUseRecovery()- Specified by:
isUseRecoveryin interfaceorg.apache.camel.spi.RecoverableAggregationRepository
-
setUseRecovery
public void setUseRecovery(boolean useRecovery) - Specified by:
setUseRecoveryin interfaceorg.apache.camel.spi.RecoverableAggregationRepository
-
getDeadLetterUri
- Specified by:
getDeadLetterUriin interfaceorg.apache.camel.spi.RecoverableAggregationRepository
-
setDeadLetterUri
- Specified by:
setDeadLetterUriin interfaceorg.apache.camel.spi.RecoverableAggregationRepository
-
getMaximumRedeliveries
public int getMaximumRedeliveries()- Specified by:
getMaximumRedeliveriesin interfaceorg.apache.camel.spi.RecoverableAggregationRepository
-
setMaximumRedeliveries
public void setMaximumRedeliveries(int maximumRedeliveries) - Specified by:
setMaximumRedeliveriesin interfaceorg.apache.camel.spi.RecoverableAggregationRepository
-
isAllowSerializedHeaders
public boolean isAllowSerializedHeaders() -
setAllowSerializedHeaders
public void setAllowSerializedHeaders(boolean allowSerializedHeaders)
-