Database Reference
In-Depth Information
default_address boolean
);
Dropping a custom type
A custom type that is not used by any table can be dropped. The familiar drop syntax is as
follows:
DROP TYPE [ IF EXISTS ] user_defined_type_name;
Creating triggers
Cassandra provides a way to act upon when a mutation request is made on a table. It is
called trigger . Triggers are Java classes that implement
org.apache.cassandra.triggers.ITrigger . You are provided with full
mutation details, and you may return a collection of mutation objects if you wanted to
take some actions. However, you are not limited to returning mutation; you may decide to
send a mail as a trigger. Remember to keep your logic fast because it may affect the
latency.
To create a trigger class, you must implement the Itrigger interface. Compile it then
place the .class file or if packaged, the .jar file in $CASSANDRA_HOME/lib along
with any external libraries that the trigger class needed. You need to copy this file to all
the nodes and then reboot the Cassandra service. Once Cassandra is up, you may go ahead
and use that trigger.
Here's the skeleton of a trigger:
package com.mycompany.cassandra;
import java.nio.ByteBuffer;
import java.util.Collection;
import org.apache.cassandra.db.ColumnFamily;
import org.apache.cassandra.db.Mutation;
import org.apache.cassandra.triggers.ITrigger;
public class DummyTrigger implements ITrigger {
/**
* key: is the row key of incoming mutation
Search WWH ::




Custom Search