Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public class StormCassandraConstants {
public static final String CASSANDRA_HOST = "cassandra.host";
public static final String CASSANDRA_PORT = "cassandra.port";
public static final String CASSANDRA_KEYSPACE = "cassandra.keyspace";
public static final String CASSANDRA_TTL = "cassandra.ttl";
public static final String CASSANDRA_STATE_KEYSPACE = "cassandra.state.keyspace";
public static final String CASSANDRA_BATCH_MAX_SIZE = "cassandra.batch.max_size";
public static final String CASSANDRA_CLIENT_CLASS = "cassandra.client.class";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ public class AstyanaxClient<K, C, V> {
public static final String ASTYANAX_CONNECTION_POOL_CONFIGURATION = "astyanax.connectionPoolConfiguration";
public static final String ASTYANAX_CONNECTION_POOL_MONITOR = "astyanax.connectioPoolMonitor";
private Map<String, AstyanaxContext<Keyspace>> astyanaxContext = new HashMap<String, AstyanaxContext<Keyspace>>();


public Integer ttl = null;

// not static since we're carting instances around and do not want to share
// them
Expand Down Expand Up @@ -117,6 +116,10 @@ protected List<AstyanaxContext<Keyspace>> createContext(Map<String, Object> conf
cpConfig.setPort(port.intValue());
}
}
// set ttl
// this coerce-via long business is to handle Integers or longs
Long confTtl = (Long) config.get(StormCassandraConstants.CASSANDRA_TTL);
ttl = confTtl != null ? confTtl.intValue() : null;

@SuppressWarnings("unchecked")
Collection<String> keyspaces = (Collection<String>) config.get(StormCassandraConstants.CASSANDRA_KEYSPACE);
Expand Down Expand Up @@ -392,8 +395,10 @@ private void addTupleToMutation(Tuple input, ColumnFamily<K, C> columnFamily, K
TupleMapper<K, C, V> tupleMapper) {
Map<C, V> columns = tupleMapper.mapToColumns(input);
for (Map.Entry<C, V> entry : columns.entrySet()) {
mutation.withRow(columnFamily, rowKey).putColumn(entry.getKey(), entry.getValue(),
(Serializer<V>) this.serializerFor(tupleMapper.getColumnValueClass()), null);
mutation.withRow(columnFamily, rowKey).putColumn(entry.getKey(),
entry.getValue(),
(Serializer<V>) this.serializerFor(tupleMapper.getColumnValueClass()),
ttl);
}
}

Expand All @@ -406,8 +411,10 @@ private void addTupleToMutation(TridentTuple input, ColumnFamily<K, C> columnFam
}
} else {
for (Map.Entry<C, V> entry : columns.entrySet()) {
mutation.withRow(columnFamily, rowKey).putColumn(entry.getKey(), entry.getValue(),
serializerFor(tupleMapper.getColumnValueClass()), null);
mutation.withRow(columnFamily, rowKey).putColumn(entry.getKey(),
entry.getValue(),
serializerFor(tupleMapper.getColumnValueClass()),
ttl);
}
}
}
Expand Down