use of com.alibaba.spring.boot.rsocket.broker.cluster.RSocketBroker in project alibaba-rsocket-broker by alibaba.
the class RSocketBrokerHandlerRegistryImpl method getBrokerClustersEvent.
private CloudEventImpl<UpstreamClusterChangedEvent> getBrokerClustersEvent(Collection<RSocketBroker> rSocketBrokers, String topology) {
List<String> uris;
if ("internet".equals(topology)) {
uris = rSocketBrokers.stream().filter(rsocketBroker -> rsocketBroker.isActive() && rsocketBroker.getExternalDomain() != null).map(RSocketBroker::getAliasUrl).collect(Collectors.toList());
} else {
uris = rSocketBrokers.stream().filter(RSocketBroker::isActive).map(RSocketBroker::getUrl).collect(Collectors.toList());
}
UpstreamClusterChangedEvent upstreamClusterChangedEvent = new UpstreamClusterChangedEvent();
upstreamClusterChangedEvent.setGroup("");
upstreamClusterChangedEvent.setInterfaceName("*");
upstreamClusterChangedEvent.setVersion("");
upstreamClusterChangedEvent.setUris(uris);
// passing in the given attributes
return RSocketCloudEventBuilder.builder(upstreamClusterChangedEvent).withDataschema(URI.create("rsocket:event:com.alibaba.rsocket.upstream.UpstreamClusterChangedEvent")).withSource(BrokerAppContext.identity()).build();
}
Aggregations