private void insertSubscription(OwnedSubscription subscription) { Map<String, Object> json = new HashMap<String, Object>() {{ put("filter", subscription.getTableFilter().toString()); put("expiresAt", subscription.getExpiresAt().getTime()); put("eventTtl", subscription.getEventTtl().getSeconds()); put("ownerId", subscription.getOwnerId()); }}; _keyspace.getCqlSession().execute( insertInto(CF_NAME) .value(rowkeyColumn(), ROW_KEY) .value(subscriptionNameColumn(), subscription.getName()) .value(subscriptionColumn(), JsonHelper.asJson(json)) .using(ttl(Math.toIntExact(subscription.getEventTtl().getSeconds()))) .setConsistencyLevel(ConsistencyLevel.LOCAL_QUORUM)); }
private void insertSubscription(OwnedSubscription subscription) { Map<String, Object> json = new HashMap<String, Object>() {{ put("filter", subscription.getTableFilter().toString()); put("expiresAt", subscription.getExpiresAt().getTime()); put("eventTtl", subscription.getEventTtl().getSeconds()); put("ownerId", subscription.getOwnerId()); }}; _keyspace.getCqlSession().execute( insertInto(CF_NAME) .value(rowkeyColumn(), ROW_KEY) .value(subscriptionNameColumn(), subscription.getName()) .value(subscriptionColumn(), JsonHelper.asJson(json)) .using(ttl(Math.toIntExact(subscription.getEventTtl().getSeconds()))) .setConsistencyLevel(ConsistencyLevel.LOCAL_QUORUM)); }
@Override public void commit(List<History> historyList, Object rowKey) { if (historyList != null && !historyList.isEmpty()) { for (History history : historyList) { _batchStatement.add(QueryBuilder.insertInto(_tableDDL.getTableMetadata()) .value(_tableDDL.getRowKeyColumnName(), rowKey) .value(_tableDDL.getChangeIdColumnName(), history.getChangeId()) .value(_tableDDL.getValueColumnName(), _changeEncoder.encodeHistory(history)) .using(ttl(Ttls.toSeconds(_historyStore.getHistoryTtl(), 1, null))) .setConsistencyLevel(_consistencyLevel)); } } }
@Override public void commit(List<History> historyList, Object rowKey) { if (historyList != null && !historyList.isEmpty()) { for (History history : historyList) { _batchStatement.add(QueryBuilder.insertInto(_tableDDL.getTableMetadata()) .value(_tableDDL.getRowKeyColumnName(), rowKey) .value(_tableDDL.getChangeIdColumnName(), history.getChangeId()) .value(_tableDDL.getValueColumnName(), _changeEncoder.encodeHistory(history)) .using(ttl(Ttls.toSeconds(_historyStore.getHistoryTtl(), 1, null))) .setConsistencyLevel(_consistencyLevel)); } } }