Description: Save events and commands on a db Cassandra
Type: Driver - Categories: Utilities
Development status: Proof of Concept
Tested on: All platforms
Developer: P3trur0
This plugin allows to persist on Cassandra server both commands
and events
occurred on Freedomotic instances.
Using this plugin, for each automation available on the platform, the user can run a Persist data on Cassandra command that will perform the operation to save data on the database.
Once started, this plugin tries to connect to the Cassandra server defined in its configuration properties (see below).
All the data are saved in a table named freedomotic_data
.
It is not required to create it manually since this plugin, once started, automatically detects the existence of freedomotic_data
table creating it if does not exist.
This table contains the following information:
id
, it is the identifier of each persisted rowdatatype
, it is either “command” or “event”data
, it is a binary serialization of persisted event/commandavro_schema
, it is the Avro schema used for serialize/deserialize the persisted datapersistence_timestamp
, it is the persistence timestampfreedomoticInstance
, it is the identifier of the currently used Freedomotic instanceThese data could be later used for any kind of data analysis you would like to perform on Freedomotic usage. Basically it is required to deserialize the binary serialization data using the Avro schema provided to analyze the original data values properly.
Within the plugin manifest, are defined all the properties available to configure the communication of the plugin with Cassandra instance. Moreover, you can also specify both the replication factor and strategy of the server instance.
Here follows an example of manifest.
<config> <properties> <property name="description" value="Cassandra database for storing Freedomotic events and commands" /> <property name="name" value="persistence" /> <property name="category" value="protocol" /> <property name="short-name" value="persistence" /> <property name="protocol.name" value="persistence" /> <property name="startup-time" value="on load" /> <!-- Cassandra configuration --> <property name="cassandra.host" value='127.0.0.1'/> <property name="cassandra.port" value='7000'/> <property name="cassandra.keyspace" value='freedomotic'/> <property name="cassandra.replicationFactor" value='1'/> <property name="cassandra.strategy" value='SimpleStrategy'/> <property name="cassandra.user" value='user'/> <property name="cassandra.password" value='password'/> <!-- end of cassandra configuration --> </properties> </config>
The properties for the Cassandra instance configuration are:
Persistence has been tested using Cassandra server (ver. 3.9).