RabbitAdmin的initialize()方法
spring-rabbit-2.0.3 版本可以采用
@SuppressWarnings("rawtypes") Collectioncollections = this.declareCollections ? this.applicationContext.getBeansOfType(Collection.class, false, false).values() : Collections.emptyList(); for (Collection> collection : collections) { if (collection.size() > 0 && collection.iterator().next() instanceof Declarable) { for (Object declarable : collection) { if (declarable instanceof Exchange) { contextExchanges.add((Exchange) declarable); } else if (declarable instanceof Queue) { contextQueues.add((Queue) declarable); } else if (declarable instanceof Binding) { contextBindings.add((Binding) declarable); } } } }
Spring-rabbit-2.2.18版本
private void processDeclarables(CollectioncontextExchanges, Collection contextQueues, Collection contextBindings) { Collection declarables = this.applicationContext.getBeansOfType(Declarables.class, false, true) .values(); declarables.forEach(d -> { d.getDeclarables().forEach(declarable -> { if (declarable instanceof Exchange) { contextExchanges.add((Exchange) declarable); } else if (declarable instanceof Queue) { contextQueues.add((Queue) declarable); } else if (declarable instanceof Binding) { contextBindings.add((Binding) declarable); } }); }); }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)