use of com.alibaba.rsocket.observability.MetricsService in project alibaba-rsocket-broker by alibaba.
the class RSocketRequesterSupportImpl method exposedServices.
@Override
public Supplier<Set<ServiceLocator>> exposedServices() {
return () -> {
return applicationContext.getBeansWithAnnotation(RSocketService.class).values().stream().filter(bean -> !(bean instanceof RSocketServiceHealth || bean instanceof MetricsService)).map(o -> {
Class<?> managedBeanClass = AopUtils.isAopProxy(o) ? AopUtils.getTargetClass(o) : o.getClass();
RSocketService rsocketService = AnnotationUtils.findAnnotation(managedBeanClass, RSocketService.class);
// noinspection ConstantConditions
String serviceName = rsocketService.serviceInterface().getCanonicalName();
if (!rsocketService.name().isEmpty()) {
serviceName = rsocketService.name();
}
String group = properties.getGroup();
if (group == null || group.isEmpty()) {
group = rsocketService.group();
}
String version = properties.getVersion();
if (version == null || version.isEmpty()) {
version = rsocketService.version();
}
return new ServiceLocator(group, serviceName, version, rsocketService.tags());
}).collect(Collectors.toSet());
};
}
Aggregations