Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Endpoint Options

OptionDefaultDescription

clusterName

 

Cluster name

username and password

 

Session authentication

cql

 

CQL query. Can be overriden with a message header.

consistencyLevel

 

ANY, ONE, TWO, QUORUM, LOCAL_QUORUM...

prepareStatementstrueUse prepared statement (default) or not

resultSetConversionStrategy

ALL

How is ResultSet converted transformed into message body ALL, ONE, LIMIT_10, LIMIT_100...

...

The Camel Cassandra endpoint expects a bunch of simple objects (Object or Object[] or Collection<Object>) which will be bound to the CQL statement as query parameters. If message body is null or empty, then  CQL query will be executed without binding parameters.

Headers:

  • CamelCqlQuery (optional, String or RegularStatement): CQL query either as a plain String or built using the QueryBuilder.

Outgoing Message

The Camel Cassandra endpoint produces one or many a Cassandra Row objects depending on the resultSetConversionStrategythe resultSetConversionStrategy:

 

  • List<Row> if resultSetConversionStrategy is ALL or LIMIT_10[0-9]+
  • Single Row if resultSetConversionStrategy is ONE
  • Anything else, if resultSetConversionStrategy is a custom implementation of the ResultSetConversionStrategy

Repositories

Cassandra can be used to store messages message keys or messages for the idempotent and aggregation EIP.

Cassandra might not be the best tool for queuing use cases yet, read Cassandra anti-patterns queues and queue like datasets. It's advised to use LeveledCompaction and a small GC grace setting for these tables to allow tombstoned rows to be removed quickly.

Idempotent repository

The NamedCassandraIdempotentRepository stores messages keys in a Cassandra table like this:

...

This repository implementation uses lightweight transactions (also known as Compare and Set) and requires Cassandra 2.0.7+.

The CassandraIdempotentRepository Alternatively, the CassandraIdempotentRepository does not have a NAME column and can be extended to use a different data model.

...

Aggregation repository

The NamedCassandraAggregationRepository stores exchanges by correlation key in a Cassandra table like this:

Code Block
languagesql
titleCAMEL_AGGREGATION.cql
CREATE TABLE CAMEL_AGGREGATION (
  NAME varchar,        -- Repository name
  KEY varchar,         -- Correlation id
  EXCHANGE_ID varchar, -- Exchange id
  EXCHANGE blob,       -- Serialized exchange
  PRIMARY KEY (NAME, KEY)
) WITH compaction = {'class':'LeveledCompactionStrategy'}
  AND gc_grace_seconds = 86400;

The CassandraAggregationRepository Alternatively, the CassandraAggregationRepository does not have a NAME column and can be extended to use a different data model.

...