* @throws NotSubscribedException
*/
public void unsubscribeFromCartridge (String tenantDomain, String alias)
throws ADCException, NotSubscribedException {
DataInsertionAndRetrievalManager dataInsertionAndRetrievalManager = new DataInsertionAndRetrievalManager();
CartridgeSubscription cartridgeSubscription = dataInsertionAndRetrievalManager.getCartridgeSubscription(CarbonContext.getThreadLocalCarbonContext().getTenantId(), alias);
if(cartridgeSubscription != null) {
cartridgeSubscription.removeSubscription();
// Remove the information from Topology Model
// Not needed now. TopologyModel is now changed so that information is taken from subscriptions
//TopologyClusterInformationModel.getInstance().removeCluster(cartridgeSubscription.getSubscriber().getTenantId(),
// cartridgeSubscription.getType(), cartridgeSubscription.getAlias());
// remove subscription
try {
dataInsertionAndRetrievalManager.removeSubscription(cartridgeSubscription.getSubscriber().getTenantId(), alias);
} catch (PersistenceManagerException e) {
String errorMsg = "Error removing subscription for tenant " + tenantDomain + ", alias " + cartridgeSubscription.getAlias();
log.error(errorMsg);
throw new ADCException(errorMsg, e);