Search in sources :

Example 1 with AddShardNode

use of com.bakdata.conquery.models.messages.network.specific.AddShardNode in project conquery by bakdata.

the class ShardNode method sessionOpened.

@Override
public void sessionOpened(IoSession session) throws Exception {
    setLocation(session);
    NetworkSession networkSession = new NetworkSession(session);
    context = new NetworkMessageContext.ShardNodeNetworkContext(jobManager, networkSession, workers, config, validator);
    log.info("Connected to ManagerNode @ {}", session.getRemoteAddress());
    // Authenticate with ManagerNode
    context.send(new AddShardNode());
    for (Worker w : workers.getWorkers().values()) {
        w.setSession(new NetworkSession(session));
        WorkerInformation info = w.getInfo();
        log.info("Sending worker identity '{}'", info.getName());
        networkSession.send(new RegisterWorker(info));
    }
}
Also used : WorkerInformation(com.bakdata.conquery.models.worker.WorkerInformation) NetworkSession(com.bakdata.conquery.io.mina.NetworkSession) RegisterWorker(com.bakdata.conquery.models.messages.network.specific.RegisterWorker) NetworkMessageContext(com.bakdata.conquery.models.messages.network.NetworkMessageContext) AddShardNode(com.bakdata.conquery.models.messages.network.specific.AddShardNode) Worker(com.bakdata.conquery.models.worker.Worker) RegisterWorker(com.bakdata.conquery.models.messages.network.specific.RegisterWorker) ShardNodeNetworkContext(com.bakdata.conquery.models.messages.network.NetworkMessageContext.ShardNodeNetworkContext)

Aggregations

NetworkSession (com.bakdata.conquery.io.mina.NetworkSession)1 NetworkMessageContext (com.bakdata.conquery.models.messages.network.NetworkMessageContext)1 ShardNodeNetworkContext (com.bakdata.conquery.models.messages.network.NetworkMessageContext.ShardNodeNetworkContext)1 AddShardNode (com.bakdata.conquery.models.messages.network.specific.AddShardNode)1 RegisterWorker (com.bakdata.conquery.models.messages.network.specific.RegisterWorker)1 Worker (com.bakdata.conquery.models.worker.Worker)1 WorkerInformation (com.bakdata.conquery.models.worker.WorkerInformation)1