コード例 #1
0
  @Override
  public CNSSubscription getSubscription(String arn) throws Exception {

    // read form index to get composite col-name

    CmbColumnSlice<String, String> slice =
        cassandraHandler.readColumnSlice(
            AbstractDurablePersistence.CNS_KEYSPACE,
            columnFamilySubscriptionsIndex,
            arn,
            null,
            null,
            1,
            CMB_SERIALIZER.STRING_SERIALIZER,
            CMB_SERIALIZER.STRING_SERIALIZER,
            CMB_SERIALIZER.STRING_SERIALIZER);

    if (slice != null) {

      // get Column from main table

      String colName = slice.getColumns().get(0).getName();
      CnsSubscriptionProtocol protocol = getEndpointAndProtoIndexValProtocol(colName);
      String endpoint = getEndpointAndProtoIndexValEndpoint(colName);
      CmbComposite columnName = cassandraHandler.getCmbComposite(endpoint, protocol.name());
      CmbColumn<CmbComposite, String> column =
          cassandraHandler.readColumn(
              AbstractDurablePersistence.CNS_KEYSPACE,
              columnFamilySubscriptions,
              Util.getCnsTopicArn(arn),
              columnName,
              CMB_SERIALIZER.STRING_SERIALIZER,
              CMB_SERIALIZER.COMPOSITE_SERIALIZER,
              CMB_SERIALIZER.STRING_SERIALIZER);

      if (column != null) {
        CNSSubscription s = extractSubscriptionFromColumn(column, Util.getCnsTopicArn(arn));
        s.checkIsValid();
        return s;
      }
    }

    return null;
  }