use of info.xiancloud.core.distribution.service_discovery.GroupInstance 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;
}
use of info.xiancloud.core.distribution.service_discovery.GroupInstance in project xian by happyyangyuan.
the class GroupUnregistrationBridge method execute.
@Override
public UnitResponse execute(UnitRequest request) {
GroupProxy groupProxy = request.get("group", GroupProxy.class);
NodeStatus nodeStatus = request.get("nodeStatus", NodeStatus.class);
GroupInstance groupInstance = GroupRegistrationBridge.groupInstance(groupProxy, nodeStatus);
try {
GroupDiscovery.singleton.unregister(groupInstance);
return UnitResponse.success();
} catch (Exception e) {
return UnitResponse.failure(e, "group注销失败.");
}
}
Aggregations