Class CassandraIdempotentRepository
- java.lang.Object
-
- org.apache.camel.support.service.BaseService
-
- org.apache.camel.support.service.ServiceSupport
-
- org.apache.camel.processor.idempotent.cassandra.CassandraIdempotentRepository
-
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.spi.IdempotentRepository,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
- Direct Known Subclasses:
NamedCassandraIdempotentRepository
public class CassandraIdempotentRepository extends org.apache.camel.support.service.ServiceSupport implements org.apache.camel.spi.IdempotentRepositoryImplementation ofIdempotentRepositoryusing Cassandra table to store message ids. 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
-
-
Constructor Summary
Constructors Constructor Description CassandraIdempotentRepository()CassandraIdempotentRepository(com.datastax.oss.driver.api.core.CqlSession session)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(String key)voidclear()booleanconfirm(String key)booleancontains(String key)protected voiddoStart()protected voiddoStop()String[]getPKColumns()protected Object[]getPKValues(String key)String[]getPrefixPKValues()com.datastax.oss.driver.api.core.ConsistencyLevelgetReadConsistencyLevel()com.datastax.oss.driver.api.core.CqlSessiongetSession()StringgetTable()IntegergetTtl()com.datastax.oss.driver.api.core.ConsistencyLevelgetWriteConsistencyLevel()protected voidinitClearStatement()protected voidinitDeleteStatement()protected voidinitInsertStatement()protected voidinitSelectStatement()protected booleanisApplied(com.datastax.oss.driver.api.core.cql.ResultSet resultSet)booleanremove(String key)voidsetPKColumns(String... pkColumns)voidsetPrefixPKValues(String[] prefixPKValues)voidsetReadConsistencyLevel(com.datastax.oss.driver.api.core.ConsistencyLevel readConsistencyLevel)voidsetSession(com.datastax.oss.driver.api.core.CqlSession session)voidsetTable(String table)voidsetTtl(Integer ttl)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, suspend
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.camel.spi.IdempotentRepository
add, confirm, contains, remove
-
-
-
-
Method Detail
-
isApplied
protected final boolean isApplied(com.datastax.oss.driver.api.core.cql.ResultSet resultSet)
-
doStart
protected void doStart() throws Exception- Overrides:
doStartin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStop
protected void doStop() throws Exception- Overrides:
doStopin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
initInsertStatement
protected void initInsertStatement()
-
add
public boolean add(String key)
- Specified by:
addin interfaceorg.apache.camel.spi.IdempotentRepository
-
initSelectStatement
protected void initSelectStatement()
-
contains
public boolean contains(String key)
- Specified by:
containsin interfaceorg.apache.camel.spi.IdempotentRepository
-
confirm
public boolean confirm(String key)
- Specified by:
confirmin interfaceorg.apache.camel.spi.IdempotentRepository
-
initDeleteStatement
protected void initDeleteStatement()
-
remove
public boolean remove(String key)
- Specified by:
removein interfaceorg.apache.camel.spi.IdempotentRepository
-
initClearStatement
protected void initClearStatement()
-
clear
public void clear()
- Specified by:
clearin interfaceorg.apache.camel.spi.IdempotentRepository
-
getSession
public com.datastax.oss.driver.api.core.CqlSession getSession()
-
setSession
public void setSession(com.datastax.oss.driver.api.core.CqlSession session)
-
getTable
public String getTable()
-
setTable
public void setTable(String table)
-
getPKColumns
public String[] getPKColumns()
-
setPKColumns
public void setPKColumns(String... pkColumns)
-
getTtl
public Integer getTtl()
-
setTtl
public void setTtl(Integer ttl)
-
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)
-
getPrefixPKValues
public String[] getPrefixPKValues()
-
setPrefixPKValues
public void setPrefixPKValues(String[] prefixPKValues)
-
-