コード例 #1
0
 private void insertOrUpdateSubsAndIndexes(final CNSSubscription subscription, Integer ttl)
     throws Exception {
   subscription.checkIsValid();
   CmbComposite columnName =
       cassandraHandler.getCmbComposite(
           subscription.getEndpoint(), subscription.getProtocol().name());
   cassandraHandler.update(
       AbstractDurablePersistence.CNS_KEYSPACE,
       columnFamilySubscriptions,
       subscription.getTopicArn(),
       columnName,
       getColumnValuesJSON(subscription),
       CMB_SERIALIZER.STRING_SERIALIZER,
       CMB_SERIALIZER.COMPOSITE_SERIALIZER,
       CMB_SERIALIZER.STRING_SERIALIZER,
       ttl);
   cassandraHandler.insertRow(
       AbstractDurablePersistence.CNS_KEYSPACE,
       subscription.getArn(),
       columnFamilySubscriptionsIndex,
       getIndexColumnValues(subscription.getEndpoint(), subscription.getProtocol()),
       CMB_SERIALIZER.STRING_SERIALIZER,
       CMB_SERIALIZER.STRING_SERIALIZER,
       CMB_SERIALIZER.STRING_SERIALIZER,
       ttl);
   cassandraHandler.insertRow(
       AbstractDurablePersistence.CNS_KEYSPACE,
       subscription.getUserId(),
       columnFamilySubscriptionsUserIndex,
       new HashMap<String, String>() {
         {
           put(subscription.getArn(), "");
         }
       },
       CMB_SERIALIZER.STRING_SERIALIZER,
       CMB_SERIALIZER.STRING_SERIALIZER,
       CMB_SERIALIZER.STRING_SERIALIZER,
       ttl);
   cassandraHandler.insertRow(
       AbstractDurablePersistence.CNS_KEYSPACE,
       subscription.getToken(),
       columnFamilySubscriptionsTokenIndex,
       new HashMap<String, String>() {
         {
           put(subscription.getArn(), "");
         }
       },
       CMB_SERIALIZER.STRING_SERIALIZER,
       CMB_SERIALIZER.STRING_SERIALIZER,
       CMB_SERIALIZER.STRING_SERIALIZER,
       ttl);
 }