use of com.alibaba.rsocket.RSocketService 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());
};
}
use of com.alibaba.rsocket.RSocketService in project alibaba-rsocket-broker by alibaba.
the class RSocketServiceAnnotationProcessor method scanRSocketServiceAnnotation.
protected void scanRSocketServiceAnnotation(Object bean, String beanName) {
Class<?> managedBeanClass = bean.getClass();
RSocketService reactiveService = AnnotationUtils.findAnnotation(managedBeanClass, RSocketService.class);
if (reactiveService != null) {
registerRSocketService(reactiveService, bean);
}
SpringRSocketService springRSocketService = AnnotationUtils.findAnnotation(managedBeanClass, SpringRSocketService.class);
if (springRSocketService != null) {
registerRSocketService(springRSocketService, bean);
}
}
Aggregations