class ConsumerGroupTopicServiceImpl extends AbstractBaseService<ConsumerGroupTopicEntity> implements CacheUpdateService, ConsumerGroupTopicService, TimerService {

	protected void doDelete(ConsumerGroupTopicEntity consumerGroupTopicEntity){
		List<String> failTopicNames = new ArrayList<>();
		// 删除失败topic，并且清理失败消息并且解绑失败topic
		failTopicNames.add(TopicUtil.getFailTopicName(consumerGroupTopicEntity.getConsumerGroupName(),consumerGroupTopicEntity.getOriginTopicName()));
		Transaction catTransaction1 = Tracer.newTransaction("ConsumerGroupTopic", "deleteFailTopic");
		try {
			topicService.deleteFailTopic(failTopicNames, consumerGroupTopicEntity.getConsumerGroupId());
			catTransaction1.setStatus(Transaction.SUCCESS);
		} catch (Exception e) {
			catTransaction1.setStatus(e);
			throw new RuntimeException("操作失败请重试。");
		} finally {
			catTransaction1.complete();
		}

		Transaction catTransaction2 = Tracer.newTransaction("ConsumerGroupTopic",
				"deleteByConsumerGroupIdAndOriginTopicName");
		try {
			// 清除topic和失败topic的queueOffset
			queueOffsetService.deleteByConsumerGroupIdAndOriginTopicName(consumerGroupTopicEntity);
			catTransaction2.setStatus(Transaction.SUCCESS);
		} catch (Exception e) {
			catTransaction2.setStatus(e);
			throw new RuntimeException("操作失败请重试。");
		} finally {
			catTransaction2.complete();
		}

		Transaction catTransaction3 = Tracer.newTransaction("ConsumerGroupTopic",
				"deleteTopicNameFromConsumerGroup");
		try {
			// 更新consumerGroup中的topic字段
			consumerGroupService.deleteTopicNameFromConsumerGroup(consumerGroupTopicEntity);
			catTransaction3.setStatus(Transaction.SUCCESS);
		} catch (Exception e) {
			catTransaction3.setStatus(e);
			throw new RuntimeException("操作失败请重试。");
		} finally {
			catTransaction3.complete();
		}

		Transaction catTransaction4 = Tracer.newTransaction("ConsumerGroupTopic", "deleteByOriginTopicName");
		try {
			// 删除正常topic和失败topic的consumerGroupTopic
			deleteByOriginTopicName(consumerGroupTopicEntity.getConsumerGroupId(),
					consumerGroupTopicEntity.getOriginTopicName());
			catTransaction4.setStatus(Transaction.SUCCESS);
		} catch (Exception e) {
			catTransaction4.setStatus(e);
			throw new RuntimeException("操作失败请重试。");
		} finally {
			catTransaction4.complete();
		}

		Transaction catTransaction5 = Tracer.newTransaction("ConsumerGroupTopic", "deleteByOriginTopicName");
		try {
			uiAuditLogService.recordAudit(ConsumerGroupEntity.TABLE_NAME,
					consumerGroupTopicEntity.getConsumerGroupId(),
					"取消consumerGroup：" + consumerGroupTopicEntity.getConsumerGroupName() + "对主题："
							+ consumerGroupTopicEntity.getOriginTopicName() + "的订阅"
							+ JsonUtil.toJson(consumerGroupTopicEntity));
			consumerGroupService.notifyMeta(consumerGroupTopicEntity.getConsumerGroupId());
			consumerGroupService.notifyRb(consumerGroupTopicEntity.getConsumerGroupId());
			catTransaction5.setStatus(Transaction.SUCCESS);
		} catch (Exception e) {
			catTransaction5.setStatus(e);
			throw new RuntimeException("操作失败请重试。");
		} finally {
			catTransaction5.complete();
		}

	}

}