Search in sources :

Example 6 with DistroTransportAgent

use of com.alibaba.nacos.core.distributed.distro.component.DistroTransportAgent in project nacos by alibaba.

the class DistroProtocol method queryFromRemote.

/**
 * Query data from specified server.
 *
 * @param distroKey data key
 * @return data
 */
public DistroData queryFromRemote(DistroKey distroKey) {
    if (null == distroKey.getTargetServer()) {
        Loggers.DISTRO.warn("[DISTRO] Can't query data from empty server");
        return null;
    }
    String resourceType = distroKey.getResourceType();
    DistroTransportAgent transportAgent = distroComponentHolder.findTransportAgent(resourceType);
    if (null == transportAgent) {
        Loggers.DISTRO.warn("[DISTRO] Can't find transport agent for key {}", resourceType);
        return null;
    }
    return transportAgent.getData(distroKey, distroKey.getTargetServer());
}
Also used : DistroTransportAgent(com.alibaba.nacos.core.distributed.distro.component.DistroTransportAgent)

Aggregations

DistroTransportAgent (com.alibaba.nacos.core.distributed.distro.component.DistroTransportAgent)6 Member (com.alibaba.nacos.core.cluster.Member)2 DistroDataProcessor (com.alibaba.nacos.core.distributed.distro.component.DistroDataProcessor)2 DistroDataStorage (com.alibaba.nacos.core.distributed.distro.component.DistroDataStorage)2 DistroData (com.alibaba.nacos.core.distributed.distro.entity.DistroData)2 DistroFailedTaskHandler (com.alibaba.nacos.core.distributed.distro.component.DistroFailedTaskHandler)1 PostConstruct (javax.annotation.PostConstruct)1 Test (org.junit.Test)1