Search in sources :

Example 1 with ServiceCombRegistration

use of com.huaweicloud.servicecomb.discovery.registry.ServiceCombRegistration in project Sermant by huaweicloud.

the class RegisterServiceImpl method after.

@Override
public void after(Object obj, Method method, Object[] arguments, Object result) {
    if (result instanceof Microservice) {
        Microservice microservice = (Microservice) result;
        CurrentInstance.newInstance(microservice.getServiceName(), microservice.getInstance().getHostName(), RouterUtil.INVALID_PORT);
    } else if (arguments[0] instanceof ServiceCombRegistration) {
        ServiceCombRegistration serviceCombRegistration = (ServiceCombRegistration) arguments[0];
        CurrentInstance.newInstance(serviceCombRegistration.getServiceId(), serviceCombRegistration.getHost(), serviceCombRegistration.getPort());
    }
}
Also used : Microservice(org.apache.servicecomb.registry.api.registry.Microservice) ServiceCombRegistration(com.huaweicloud.servicecomb.discovery.registry.ServiceCombRegistration)

Aggregations

ServiceCombRegistration (com.huaweicloud.servicecomb.discovery.registry.ServiceCombRegistration)1 Microservice (org.apache.servicecomb.registry.api.registry.Microservice)1