use of com.alibaba.nacos.naming.core.v2.client.ClientAttributes in project nacos by alibaba.
the class ConnectionBasedClientManager method clientConnected.
@Override
public void clientConnected(Connection connect) {
if (!RemoteConstants.LABEL_MODULE_NAMING.equals(connect.getMetaInfo().getLabel(RemoteConstants.LABEL_MODULE))) {
return;
}
ClientAttributes attributes = new ClientAttributes();
attributes.addClientAttribute(ClientConstants.CONNECTION_TYPE, connect.getMetaInfo().getConnectType());
attributes.addClientAttribute(ClientConstants.CONNECTION_METADATA, connect.getMetaInfo());
clientConnected(connect.getMetaInfo().getConnectionId(), attributes);
}
use of com.alibaba.nacos.naming.core.v2.client.ClientAttributes in project nacos by alibaba.
the class ConnectionBasedClientManager method clientConnected.
@Override
public boolean clientConnected(String clientId, ClientAttributes attributes) {
String type = attributes.getClientAttribute(ClientConstants.CONNECTION_TYPE);
ClientFactory clientFactory = ClientFactoryHolder.getInstance().findClientFactory(type);
return clientConnected(clientFactory.newClient(clientId, attributes));
}
use of com.alibaba.nacos.naming.core.v2.client.ClientAttributes in project nacos by alibaba.
the class ConnectionBasedClientManager method syncClientConnected.
@Override
public boolean syncClientConnected(String clientId, ClientAttributes attributes) {
String type = attributes.getClientAttribute(ClientConstants.CONNECTION_TYPE);
ClientFactory clientFactory = ClientFactoryHolder.getInstance().findClientFactory(type);
return clientConnected(clientFactory.newSyncedClient(clientId, attributes));
}
use of com.alibaba.nacos.naming.core.v2.client.ClientAttributes in project nacos by alibaba.
the class PersistentClientOperationServiceImpl method onInstanceRegister.
private void onInstanceRegister(Service service, Instance instance, String clientId) {
Service singleton = ServiceManager.getInstance().getSingleton(service);
if (!clientManager.contains(clientId)) {
clientManager.clientConnected(clientId, new ClientAttributes());
}
Client client = clientManager.getClient(clientId);
InstancePublishInfo instancePublishInfo = getPublishInfo(instance);
client.addServiceInstance(singleton, instancePublishInfo);
client.setLastUpdatedTime();
NotifyCenter.publishEvent(new ClientOperationEvent.ClientRegisterServiceEvent(singleton, clientId));
}
Aggregations