use of com.alipay.sofa.registry.client.api.Publisher in project dubbo by apache.
the class SofaRegistryServiceDiscovery method doRegister.
@Override
public void doRegister(ServiceInstance serviceInstance) {
SofaRegistryInstance sofaRegistryInstance = new SofaRegistryInstance(serviceInstance.getId(), serviceInstance.getHost(), serviceInstance.getPort(), serviceInstance.getServiceName(), serviceInstance.getMetadata());
Publisher publisher = publishers.get(serviceInstance.getServiceName());
this.serviceInstance = serviceInstance;
if (null == publisher) {
PublisherRegistration registration = new PublisherRegistration(serviceInstance.getServiceName());
registration.setGroup(DEFAULT_GROUP);
publisher = registryClient.register(registration, gson.toJson(sofaRegistryInstance));
publishers.put(serviceInstance.getServiceName(), publisher);
} else {
publisher.republish(gson.toJson(sofaRegistryInstance));
}
}
use of com.alipay.sofa.registry.client.api.Publisher in project dubbo by alibaba.
the class SofaRegistryServiceDiscovery method doRegister.
@Override
public void doRegister(ServiceInstance serviceInstance) {
SofaRegistryInstance sofaRegistryInstance = new SofaRegistryInstance(serviceInstance.getId(), serviceInstance.getHost(), serviceInstance.getPort(), serviceInstance.getServiceName(), serviceInstance.getMetadata());
Publisher publisher = publishers.get(serviceInstance.getServiceName());
this.serviceInstance = serviceInstance;
if (null == publisher) {
PublisherRegistration registration = new PublisherRegistration(serviceInstance.getServiceName());
registration.setGroup(DEFAULT_GROUP);
publisher = registryClient.register(registration, gson.toJson(sofaRegistryInstance));
publishers.put(serviceInstance.getServiceName(), publisher);
} else {
publisher.republish(gson.toJson(sofaRegistryInstance));
}
}
Aggregations