Skip to content

Commit

Permalink
影子主题取消生产订阅将原主题shadow属性设为false
Browse files Browse the repository at this point in the history
  • Loading branch information
iamazy committed Jan 15, 2021
1 parent 6df84ff commit 40f3763
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,15 @@ public Response queryByTopic(@Body QProducer qProducer) throws Exception {
@Path("delete")
public Response delete(@QueryParam(ID) String id) throws Exception {
Producer producer = service.findById(id);
if (producer.getTopic().getCode().startsWith("shadow_")) {
String srcTopicCode = producer.getTopic().getCode().substring("shadow_".length());
String app = producer.getApp().getCode();
Producer srcProducer = service.findByTopicAppGroup("", srcTopicCode, app);
if (srcProducer.getConfig() != null && srcProducer.getConfig().getParams() != null) {
srcProducer.getConfig().getParams().put("shadow", "false");
service.update(srcProducer);
}
}
int count = service.delete(producer);
if (count <= 0) {
throw new ConfigException(deleteErrorCode());
Expand Down

0 comments on commit 40f3763

Please sign in to comment.