A database trigger is procedural code that is automatically executed in response to certain events on a particular table or view in a database.
The trigger is mostly used for maintaining the integrity of the information on the database. For example, when a new record (representing a new worker) is added to the employees table, new records should also be created in the tables of the taxes, vacations and salaries.
For supporting streaming from cassandra 1.2.x versions, lightweight Triggers are implemented as follows.
- An aspect is configured to track mutation events within cassandra system
- This aspect is called after the mutation operation and can see the row mutations of cassandra
- For the respective column Family, The pre-configured triggers are executed.
A column family is created to store the configured trigger classes for a given keyspace and column Family. These triggers are loaded initially when starting the cassandra server. If there is any change in Trigger configuration, There is an option provided to load triggers from JMX.
These lightweight triggers are a powerful mechanism that allows for data streaming from cassandra. This stream is pluggable with help of implemented triggers. We have configured streaming to Zeromq.
Note: Triggers are part of apache cassandra distribution since v2.0. This work is done to support triggers for version 1.2.X