use of info.xiancloud.core.distribution.service_discovery.GroupInstanceIdBean in project xian by happyyangyuan.
the class GroupRouter method localInstance.
@Override
public GroupInstance localInstance(String groupName) {
return LocalUnitsManager.unitMap(unitMap -> {
if (unitMap.containsKey(groupName)) {
GroupInstance serviceInstance = new GroupInstance();
serviceInstance.setRegistrationTimestamp(LocalNodeManager.singleton.getFullStatus().getInitTime());
serviceInstance.setPort(Node.RPC_PORT);
serviceInstance.setName(groupName);
serviceInstance.setEnabled(true);
serviceInstance.setAddress(EnvUtil.getLocalIp());
serviceInstance.setId(new GroupInstanceIdBean(groupName, LocalNodeManager.LOCAL_NODE_ID).getGroupInstanceId());
serviceInstance.setPayload(GroupProxy.create(LocalUnitsManager.getGroupByName(groupName)));
return serviceInstance;
} else {
return null;
}
});
}
use of info.xiancloud.core.distribution.service_discovery.GroupInstanceIdBean in project xian by happyyangyuan.
the class ZkGroupDiscovery method instance.
@Override
public GroupInstance instance(String groupInstanceId) {
String groupName = new GroupInstanceIdBean(groupInstanceId).getGroup();
ServiceInstance<GroupProxy> instance = serviceProviders.getUnchecked(groupName).getInstance(groupInstanceId);
if (instance == null)
instance = nonCachedInstanceProviders.getUnchecked(groupName).getInstance(groupInstanceId);
return ZkServiceInstanceAdaptor.groupInstance(instance);
}
use of info.xiancloud.core.distribution.service_discovery.GroupInstanceIdBean in project xian by happyyangyuan.
the class GroupRegistrationBridge method groupInstance.
static GroupInstance groupInstance(GroupProxy groupProxy, NodeStatus nodeStatus) {
GroupInstance groupInstance = new GroupInstance();
groupInstance.setRegistrationTimestamp(nodeStatus.getInitTime());
groupInstance.setPort(nodeStatus.getPort());
groupInstance.setName(groupProxy.getName());
groupInstance.setEnabled(true);
groupInstance.setAddress(nodeStatus.getHost());
groupInstance.setGroupInstanceIdBean(new GroupInstanceIdBean(groupProxy.getName(), LocalNodeManager.LOCAL_NODE_ID));
groupInstance.setPayload(groupProxy);
return groupInstance;
}
Aggregations