Example usage for org.apache.cassandra.db.partitions Partition partitionKey

List of usage examples for org.apache.cassandra.db.partitions Partition partitionKey

Introduction

In this page you can find the example usage for org.apache.cassandra.db.partitions Partition partitionKey.

Prototype

public DecoratedKey partitionKey();

Source Link

Usage

From source file:io.jmnarloch.cassandra.kafka.trigger.KafkaCommitLogTrigger.java

License:Apache License

@Override
public Collection<Mutation> augment(Partition update) {

    try (final CommitLog commitLog = new KafkaCommitLog(environment)) {
        final String key = getKey(update);
        final RowIterator rows = rowIterator(update.unfilteredIterator());
        while (rows.hasNext()) {
            final byte[] data = formatter
                    .format(new RowInfo(update.metadata(), update.partitionKey(), rows.next()));
            commitLog.commit(key, data);
        }/*from  ww w.j  av  a2  s  .c  om*/
        return nothing();
    } catch (Exception e) {
        throw new CommitLogException("An unexpected error occurred when trying to export the row data", e);
    }
}

From source file:io.jmnarloch.cassandra.kafka.utils.CassandraUtils.java

License:Apache License

public static String getKey(Partition partition) {
    return partition.metadata().getKeyValidator().getString(partition.partitionKey().getKey());
}