cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From J Ramesh Kumar <>
Subject Sample Trigger Code to get inserted value
Date Wed, 27 Nov 2013 11:40:50 GMT

I need your help on extract column names and values in the trigger augment

*Table Def :*

create table dy_data (
id timeuuid,
data_key text,
time timestamp,
data text,
primary key((id,data_key),time)) with clustering order by (time desc);

public class ArchiveTrigger implements ITrigger {
  public Collection<RowMutation> augment(ByteBuffer key, ColumnFamily cf) {
        try {
            *// Below loop only has 2 columns ( one is "data" and another
one may be "time" but i am not sure, because i cannot get value.   *

            for (Column cell : cf) {
               * //Got Exception if I try to get column name*
                String name = ByteBufferUtil.string(;
               * //Got only "data" column value and empty value for another
column may be "time"*. *If I try ByteBufferUtil.toLong(cell.value()) it
throws exception*
                String value = ByteBufferUtil.string(cell.value());
                log(" name = " + name);
                log(" value = " + value);
        } catch (Exception e) {
            logger.warn("Exception ", e);
        return null;

I tried my best to search sample code in google. But failed. Please help me
with sample code.

Thanks in advance.


View raw message