Class CassandraEndpoint
- java.lang.Object
-
- org.apache.camel.support.service.BaseService
-
- org.apache.camel.support.service.ServiceSupport
-
- org.apache.camel.support.DefaultEndpoint
-
- org.apache.camel.support.ScheduledPollEndpoint
-
- org.apache.camel.component.cassandra.CassandraEndpoint
-
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.CamelContextAware,org.apache.camel.Endpoint,org.apache.camel.IsSingleton,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.spi.HasId,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
@UriEndpoint(firstVersion="2.15.0", scheme="cql", title="Cassandra CQL", syntax="cql:beanRef:hosts:port/keyspace", category={DATABASE,NOSQL}) public class CassandraEndpoint extends org.apache.camel.support.ScheduledPollEndpointIntegrate with Cassandra 2.0+ using the CQL3 API (not the Thrift API). Based on Cassandra Java Driver provided by DataStax.
-
-
Constructor Summary
Constructors Constructor Description CassandraEndpoint(String endpointUri, org.apache.camel.Component component)CassandraEndpoint(String uri, CassandraComponent component, com.datastax.oss.driver.api.core.CqlSession session, String keyspace)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description org.apache.camel.ConsumercreateConsumer(org.apache.camel.Processor processor)org.apache.camel.ProducercreateProducer()protected com.datastax.oss.driver.api.core.CqlSessionBuildercreateSessionBuilder()protected voiddoStart()protected voiddoStop()protected voidfillMessage(com.datastax.oss.driver.api.core.cql.ResultSet resultSet, org.apache.camel.Message message)Copy ResultSet into Message.StringgetBean()StringgetBeanRef()Deprecated.StringgetClusterName()com.datastax.oss.driver.api.core.ConsistencyLevelgetConsistencyLevel()StringgetCql()StringgetDatacenter()StringgetHosts()StringgetKeyspace()StringgetLoadBalancingPolicyClass()To use a specific LoadBalancingPolicyClassStringgetPassword()IntegergetPort()ResultSetConversionStrategygetResultSetConversionStrategy()com.datastax.oss.driver.api.core.CqlSessiongetSession()protected CassandraSessionHoldergetSessionHolder()StringgetUsername()booleanisPrepareStatements()protected com.datastax.oss.driver.api.core.cql.PreparedStatementprepareStatement()Create and configure a Prepared CQL statementprotected com.datastax.oss.driver.api.core.cql.PreparedStatementprepareStatement(String cql)Create and configure a Prepared CQL statementvoidsetBean(String beanRef)Instead of using a hostname:port, refer to an existing configured Session or Cluster from the Camel registry to be used.voidsetBeanRef(String beanRef)Deprecated.voidsetClusterName(String clusterName)Cluster namevoidsetConsistencyLevel(com.datastax.oss.driver.api.core.DefaultConsistencyLevel consistencyLevel)Consistency level to usevoidsetCql(String cql)CQL query to perform.voidsetDatacenter(String datacenter)Datacenter to usevoidsetHosts(String hosts)Hostname(s) Cassandra server(s).voidsetKeyspace(String keyspace)Keyspace to usevoidsetLoadBalancingPolicyClass(String loadBalancingPolicyClass)voidsetPassword(String password)Password for session authenticationvoidsetPort(Integer port)Port number of Cassandra server(s)voidsetPrepareStatements(boolean prepareStatements)Whether to use PreparedStatements or regular StatementsvoidsetResultSetConversionStrategy(ResultSetConversionStrategy resultSetConversionStrategy)To use a custom class that implements logic for converting ResultSet into message body ALL, ONE, LIMIT_10, LIMIT_100...voidsetSession(com.datastax.oss.driver.api.core.CqlSession session)To use the Session instance (you would normally not use this option)voidsetUsername(String username)Username for session authentication-
Methods inherited from class org.apache.camel.support.ScheduledPollEndpoint
configureConsumer, configureProperties, configureScheduledPollConsumerProperties, doConfigureConsumer, getBackoffErrorThreshold, getBackoffIdleThreshold, getBackoffMultiplier, getDefaultDelay, getDelay, getInitialDelay, getPollStrategy, getRepeatCount, getRunLoggingLevel, getScheduledExecutorService, getScheduler, getSchedulerProperties, getTimeUnit, isGreedy, isSendEmptyMessageWhenIdle, isStartScheduler, isUseFixedDelay, setBackoffErrorThreshold, setBackoffIdleThreshold, setBackoffMultiplier, setDelay, setGreedy, setInitialDelay, setPollStrategy, setRepeatCount, setRunLoggingLevel, setScheduledExecutorService, setScheduler, setSchedulerProperties, setSendEmptyMessageWhenIdle, setStartScheduler, setTimeUnit, setUseFixedDelay
-
Methods inherited from class org.apache.camel.support.DefaultEndpoint
configureExchange, configurePollingConsumer, createAsyncProducer, createEndpointUri, createExchange, createExchange, createPollingConsumer, doInit, equals, getCamelContext, getComponent, getEndpointKey, getEndpointUri, getExceptionHandler, getExchangePattern, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isAutowiredEnabled, isBridgeErrorHandler, isLazyStartProducer, isLenientProperties, isPollingConsumerBlockWhenFull, isPollingConsumerCopy, isSingleton, setAutowiredEnabled, setBridgeErrorHandler, setCamelContext, setComponent, setEndpointUri, setEndpointUriIfNotSpecified, setExceptionHandler, setExchangePattern, setLazyStartProducer, setPollingConsumerBlockTimeout, setPollingConsumerBlockWhenFull, setPollingConsumerCopy, setPollingConsumerQueueSize, setProperties, toString
-
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, 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, finalize, getClass, notify, notifyAll, wait, wait, wait
-
-
-
-
Constructor Detail
-
CassandraEndpoint
public CassandraEndpoint(String endpointUri, org.apache.camel.Component component)
-
CassandraEndpoint
public CassandraEndpoint(String uri, CassandraComponent component, com.datastax.oss.driver.api.core.CqlSession session, String keyspace)
-
-
Method Detail
-
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception- Throws:
Exception
-
doStart
protected void doStart() throws Exception- Overrides:
doStartin classorg.apache.camel.support.ScheduledPollEndpoint- Throws:
Exception
-
doStop
protected void doStop() throws Exception- Overrides:
doStopin classorg.apache.camel.support.ScheduledPollEndpoint- Throws:
Exception
-
getSessionHolder
protected CassandraSessionHolder getSessionHolder()
-
createSessionBuilder
protected com.datastax.oss.driver.api.core.CqlSessionBuilder createSessionBuilder()
-
prepareStatement
protected com.datastax.oss.driver.api.core.cql.PreparedStatement prepareStatement(String cql)
Create and configure a Prepared CQL statement
-
prepareStatement
protected com.datastax.oss.driver.api.core.cql.PreparedStatement prepareStatement()
Create and configure a Prepared CQL statement
-
fillMessage
protected void fillMessage(com.datastax.oss.driver.api.core.cql.ResultSet resultSet, org.apache.camel.Message message)Copy ResultSet into Message.
-
getBean
public String getBean()
-
setBean
public void setBean(String beanRef)
Instead of using a hostname:port, refer to an existing configured Session or Cluster from the Camel registry to be used.
-
getBeanRef
@Deprecated public String getBeanRef()
Deprecated.
-
setBeanRef
@Deprecated public void setBeanRef(String beanRef)
Deprecated.
-
getHosts
public String getHosts()
-
setHosts
public void setHosts(String hosts)
Hostname(s) Cassandra server(s). Multiple hosts can be separated by comma.
-
getPort
public Integer getPort()
-
setPort
public void setPort(Integer port)
Port number of Cassandra server(s)
-
getKeyspace
public String getKeyspace()
-
setKeyspace
public void setKeyspace(String keyspace)
Keyspace to use
-
getDatacenter
public String getDatacenter()
-
setDatacenter
public void setDatacenter(String datacenter)
Datacenter to use
-
getCql
public String getCql()
-
setCql
public void setCql(String cql)
CQL query to perform. Can be overridden with the message header with key CamelCqlQuery.
-
getSession
public com.datastax.oss.driver.api.core.CqlSession getSession()
-
setSession
public void setSession(com.datastax.oss.driver.api.core.CqlSession session)
To use the Session instance (you would normally not use this option)
-
getClusterName
public String getClusterName()
-
setClusterName
public void setClusterName(String clusterName)
Cluster name
-
getUsername
public String getUsername()
-
setUsername
public void setUsername(String username)
Username for session authentication
-
getPassword
public String getPassword()
-
setPassword
public void setPassword(String password)
Password for session authentication
-
getConsistencyLevel
public com.datastax.oss.driver.api.core.ConsistencyLevel getConsistencyLevel()
-
setConsistencyLevel
public void setConsistencyLevel(com.datastax.oss.driver.api.core.DefaultConsistencyLevel consistencyLevel)
Consistency level to use
-
getResultSetConversionStrategy
public ResultSetConversionStrategy getResultSetConversionStrategy()
-
setResultSetConversionStrategy
public void setResultSetConversionStrategy(ResultSetConversionStrategy resultSetConversionStrategy)
To use a custom class that implements logic for converting ResultSet into message body ALL, ONE, LIMIT_10, LIMIT_100...
-
isPrepareStatements
public boolean isPrepareStatements()
-
setPrepareStatements
public void setPrepareStatements(boolean prepareStatements)
Whether to use PreparedStatements or regular Statements
-
getLoadBalancingPolicyClass
public String getLoadBalancingPolicyClass()
To use a specific LoadBalancingPolicyClass
-
setLoadBalancingPolicyClass
public void setLoadBalancingPolicyClass(String loadBalancingPolicyClass)
-
-