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}, headersClass=CassandraConstants.class) public class CassandraEndpoint extends org.apache.camel.support.ScheduledPollEndpoint
Integrate 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.Consumer
createConsumer(org.apache.camel.Processor processor)
org.apache.camel.Producer
createProducer()
protected com.datastax.oss.driver.api.core.CqlSessionBuilder
createSessionBuilder()
protected void
doStart()
protected void
doStop()
protected void
fillMessage(com.datastax.oss.driver.api.core.cql.ResultSet resultSet, org.apache.camel.Message message)
Copy ResultSet into Message.String
getBean()
String
getBeanRef()
Deprecated.String
getClusterName()
com.datastax.oss.driver.api.core.ConsistencyLevel
getConsistencyLevel()
String
getCql()
String
getDatacenter()
String
getExtraTypeCodecs()
To use a specific comma separated list of Extra Type codecs.String
getHosts()
String
getKeyspace()
String
getLoadBalancingPolicyClass()
To use a specific LoadBalancingPolicyClassString
getPassword()
Integer
getPort()
ResultSetConversionStrategy
getResultSetConversionStrategy()
com.datastax.oss.driver.api.core.CqlSession
getSession()
protected CassandraSessionHolder
getSessionHolder()
String
getUsername()
boolean
isPrepareStatements()
protected com.datastax.oss.driver.api.core.cql.PreparedStatement
prepareStatement()
Create and configure a Prepared CQL statementprotected com.datastax.oss.driver.api.core.cql.PreparedStatement
prepareStatement(String cql)
Create and configure a Prepared CQL statementvoid
setBean(String beanRef)
Instead of using a hostname:port, refer to an existing configured Session or Cluster from the Camel registry to be used.void
setBeanRef(String beanRef)
Deprecated.void
setClusterName(String clusterName)
Cluster namevoid
setConsistencyLevel(com.datastax.oss.driver.api.core.DefaultConsistencyLevel consistencyLevel)
Consistency level to usevoid
setCql(String cql)
CQL query to perform.void
setDatacenter(String datacenter)
Datacenter to usevoid
setExtraTypeCodecs(String extraTypeCodecs)
void
setHosts(String hosts)
Hostname(s) Cassandra server(s).void
setKeyspace(String keyspace)
Keyspace to usevoid
setLoadBalancingPolicyClass(String loadBalancingPolicyClass)
void
setPassword(String password)
Password for session authenticationvoid
setPort(Integer port)
Port number of Cassandra server(s)void
setPrepareStatements(boolean prepareStatements)
Whether to use PreparedStatements or regular Statementsvoid
setResultSetConversionStrategy(ResultSetConversionStrategy resultSetConversionStrategy)
To use a custom class that implements logic for converting ResultSet into message body ALL, ONE, LIMIT_10, LIMIT_100...void
setSession(com.datastax.oss.driver.api.core.CqlSession session)
To use the Session instance (you would normally not use this option)void
setUsername(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:
doStart
in classorg.apache.camel.support.ScheduledPollEndpoint
- Throws:
Exception
-
doStop
protected void doStop() throws Exception
- Overrides:
doStop
in 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)
-
getExtraTypeCodecs
public String getExtraTypeCodecs()
To use a specific comma separated list of Extra Type codecs. Possible values are: BLOB_TO_ARRAY, BOOLEAN_LIST_TO_ARRAY, BYTE_LIST_TO_ARRAY, SHORT_LIST_TO_ARRAY, INT_LIST_TO_ARRAY, LONG_LIST_TO_ARRAY, FLOAT_LIST_TO_ARRAY, DOUBLE_LIST_TO_ARRAY, TIMESTAMP_UTC, TIMESTAMP_MILLIS_SYSTEM, TIMESTAMP_MILLIS_UTC, ZONED_TIMESTAMP_SYSTEM, ZONED_TIMESTAMP_UTC, ZONED_TIMESTAMP_PERSISTED, LOCAL_TIMESTAMP_SYSTEM and LOCAL_TIMESTAMP_UTC
-
setExtraTypeCodecs
public void setExtraTypeCodecs(String extraTypeCodecs)
-
-