Search in sources :

Example 1 with ServicesHiddenEvent

use of com.alibaba.rsocket.events.ServicesHiddenEvent in project alibaba-rsocket-broker by alibaba.

the class RSocketBrokerClient method removeService.

public void removeService(String serviceName, Class<?> serviceInterface) {
    ServiceLocator targetService = new ServiceLocator("", serviceName, "");
    CloudEventImpl<ServicesHiddenEvent> cloudEvent = ServicesHiddenEvent.convertServicesToCloudEvent(Collections.singletonList(targetService));
    upstreamManager.findBroker().getLoadBalancedRSocket().fireCloudEventToUpstreamAll(cloudEvent).doOnSuccess(unused -> {
        this.serviceCaller.removeProvider("", serviceName, "", serviceInterface);
    }).subscribe();
}
Also used : ServiceLocator(com.alibaba.rsocket.ServiceLocator) RSocketMimeType(com.alibaba.rsocket.metadata.RSocketMimeType) RSocketServiceHealth(com.alibaba.rsocket.health.RSocketServiceHealth) Logger(org.slf4j.Logger) UpstreamCluster(com.alibaba.rsocket.upstream.UpstreamCluster) RsocketErrorCode(com.alibaba.rsocket.observability.RsocketErrorCode) LoggerFactory(org.slf4j.LoggerFactory) TopicProcessor(reactor.extra.processor.TopicProcessor) UpstreamManagerImpl(com.alibaba.rsocket.upstream.UpstreamManagerImpl) Mono(reactor.core.publisher.Mono) CloudEventsProcessor(com.alibaba.rsocket.events.CloudEventsProcessor) Collectors(java.util.stream.Collectors) ServicesHiddenEvent(com.alibaba.rsocket.events.ServicesHiddenEvent) ArrayList(java.util.ArrayList) List(java.util.List) RSocketRemoteServiceBuilder(com.alibaba.rsocket.invocation.RSocketRemoteServiceBuilder) UpstreamClusterChangedEventConsumer(com.alibaba.rsocket.upstream.UpstreamClusterChangedEventConsumer) ServicesExposedEvent(com.alibaba.rsocket.events.ServicesExposedEvent) CloudEventImpl(com.alibaba.rsocket.cloudevents.CloudEventImpl) Map(java.util.Map) UpstreamManager(com.alibaba.rsocket.upstream.UpstreamManager) LocalReactiveServiceCaller(com.alibaba.rsocket.rpc.LocalReactiveServiceCaller) Collections(java.util.Collections) ServiceLocator(com.alibaba.rsocket.ServiceLocator) ServicesHiddenEvent(com.alibaba.rsocket.events.ServicesHiddenEvent)

Aggregations

ServiceLocator (com.alibaba.rsocket.ServiceLocator)1 CloudEventImpl (com.alibaba.rsocket.cloudevents.CloudEventImpl)1 CloudEventsProcessor (com.alibaba.rsocket.events.CloudEventsProcessor)1 ServicesExposedEvent (com.alibaba.rsocket.events.ServicesExposedEvent)1 ServicesHiddenEvent (com.alibaba.rsocket.events.ServicesHiddenEvent)1 RSocketServiceHealth (com.alibaba.rsocket.health.RSocketServiceHealth)1 RSocketRemoteServiceBuilder (com.alibaba.rsocket.invocation.RSocketRemoteServiceBuilder)1 RSocketMimeType (com.alibaba.rsocket.metadata.RSocketMimeType)1 RsocketErrorCode (com.alibaba.rsocket.observability.RsocketErrorCode)1 LocalReactiveServiceCaller (com.alibaba.rsocket.rpc.LocalReactiveServiceCaller)1 UpstreamCluster (com.alibaba.rsocket.upstream.UpstreamCluster)1 UpstreamClusterChangedEventConsumer (com.alibaba.rsocket.upstream.UpstreamClusterChangedEventConsumer)1 UpstreamManager (com.alibaba.rsocket.upstream.UpstreamManager)1 UpstreamManagerImpl (com.alibaba.rsocket.upstream.UpstreamManagerImpl)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 Logger (org.slf4j.Logger)1