Search in sources :

Example 1 with ClientEvent

use of com.alibaba.nacos.naming.core.v2.event.client.ClientEvent in project nacos by alibaba.

the class DistroClientDataProcessor method syncToAllServer.

private void syncToAllServer(ClientEvent event) {
    Client client = event.getClient();
    // Only ephemeral data sync by Distro, persist client should sync by raft.
    if (null == client || !client.isEphemeral() || !clientManager.isResponsibleClient(client)) {
        return;
    }
    if (event instanceof ClientEvent.ClientDisconnectEvent) {
        DistroKey distroKey = new DistroKey(client.getClientId(), TYPE);
        distroProtocol.sync(distroKey, DataOperation.DELETE);
    } else if (event instanceof ClientEvent.ClientChangedEvent) {
        DistroKey distroKey = new DistroKey(client.getClientId(), TYPE);
        distroProtocol.sync(distroKey, DataOperation.CHANGE);
    }
}
Also used : Client(com.alibaba.nacos.naming.core.v2.client.Client) DistroKey(com.alibaba.nacos.core.distributed.distro.entity.DistroKey) ClientEvent(com.alibaba.nacos.naming.core.v2.event.client.ClientEvent)

Aggregations

DistroKey (com.alibaba.nacos.core.distributed.distro.entity.DistroKey)1 Client (com.alibaba.nacos.naming.core.v2.client.Client)1 ClientEvent (com.alibaba.nacos.naming.core.v2.event.client.ClientEvent)1