Commit 6620aba9 by 赵剑炜

优化了绑定的逻辑

parent 0c7db0a6
...@@ -12,6 +12,7 @@ import org.springframework.context.annotation.Configuration; ...@@ -12,6 +12,7 @@ import org.springframework.context.annotation.Configuration;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.CompletableFuture;
@Configuration @Configuration
public class TopicRabbitConfig { public class TopicRabbitConfig {
...@@ -39,8 +40,14 @@ public class TopicRabbitConfig { ...@@ -39,8 +40,14 @@ public class TopicRabbitConfig {
// Dynamic creation of queues and bindings for each organization and cabinet // Dynamic creation of queues and bindings for each organization and cabinet
@Bean @Bean
public List<Binding> createQueuesAndBindings(TopicExchange topicExchange) { public List<Binding> createQueuesAndBindings(TopicExchange topicExchange) {
List<PubOrg> orgList = pubOrgService.list(new LambdaQueryWrapper<PubOrg>().eq(PubOrg::getStatusFlag, 1)); CompletableFuture<List<PubOrg>> orgListFuture = CompletableFuture.supplyAsync(() ->
List<Cabinet> cabinetList = cabinetService.list(); pubOrgService.list(new LambdaQueryWrapper<PubOrg>().eq(PubOrg::getDelFlag, 1)));
CompletableFuture<List<Cabinet>> cabinetListFuture = CompletableFuture.supplyAsync(() ->
cabinetService.list());
List<PubOrg> orgList = orgListFuture.join();
List<Cabinet> cabinetList = cabinetListFuture.join();
List<Binding> bindings = new ArrayList<>(); List<Binding> bindings = new ArrayList<>();
for (PubOrg org : orgList) { for (PubOrg org : orgList) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论