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

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

Introduction

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

Prototype

public TableMetadata metadata();

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);
        }/*www.  j a v a 2s  .  com*/
        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());
}