Skip to content

API Docs - v1.0.4

Store

cassandra (Store)

This extension assigns data sources and connection instructions to event tables. It also implements read-write operations on connected datasource.

Syntax

@Store(type="cassandra", cassandra.host="<STRING>", column.family="<STRING>", client.port="<STRING>", keyspace="<STRING>", username="<STRING>", password="<STRING>")
@PrimaryKey("PRIMARY_KEY")
@Index("INDEX")

QUERY PARAMETERS

Name Description Default Value Possible Data Types Optional Dynamic
cassandra.host Host that is used to get connected in to the cassandra keyspace. localhost STRING No No
column.family The name with which the event table should be persisted in the store. If no name is specified via this parameter, the event table is persisted with the same name as the Siddhi table. The table name defined in the Siddhi Application query. STRING Yes No
client.port Client port that is used to get connected with the client store. If no name is specified via this parameter, the default port is taken. 9042 STRING Yes No
keyspace User need to give the keyspace that the data is persisted. Keyspace name is specified via this parameter. cassandraTestTable STRING No No
username Through user name user can specify the relevent username that is used to log in to the cassandra keyspace . The username of the keyspace STRING Yes No
password Through password user can specify the relevent password that is used to log in to the cassandra keyspace . The password of the keyspace STRING Yes No

Examples EXAMPLE 1

define stream StockStream (symbol string, price float, volume long); 
@Store(type='cassandra', column.family='StockTable',keyspace='AnalyticsFamily',username='cassandra',password='cassandra',cassandra.host='localhost')@IndexBy('volume')@PrimaryKey('symbol')define table StockTable (symbol string, price float, volume long); 

This definition creates an event table named StockTable in the AnalyticsFamily keyspace on the Cassandra instance if it does not already exist (with 3 attributes named symbol, price, and volume of the string, float and long types respectively). The connection is made as specified by the parameters configured for the '@Store' annotation. The symbol attribute is considered a unique field, and the values for this attribute are the Cassandra row IDs.