use of com.bakdata.conquery.models.messages.network.MessageToManagerNode in project conquery by bakdata.
the class ManagerNode method messageReceived.
@Override
public void messageReceived(IoSession session, Object message) throws Exception {
ConqueryMDC.setLocation("ManagerNode[" + session.getLocalAddress().toString() + "]");
if (message instanceof MessageToManagerNode) {
MessageToManagerNode mrm = (MessageToManagerNode) message;
log.trace("ManagerNode received {} from {}", message.getClass().getSimpleName(), session.getRemoteAddress());
ReactingJob<MessageToManagerNode, NetworkMessageContext.ManagerNodeNetworkContext> job = new ReactingJob<>(mrm, new NetworkMessageContext.ManagerNodeNetworkContext(jobManager, new NetworkSession(session), datasetRegistry, config.getCluster().getBackpressure()));
// TODO: 01.07.2020 FK: distribute messages/jobs to their respective JobManagers (if they have one)
if (mrm.isSlowMessage()) {
((SlowMessage) mrm).setProgressReporter(job.getProgressReporter());
jobManager.addSlowJob(job);
} else {
jobManager.addFastJob(job);
}
} else {
log.error("Unknown message type {} in {}", message.getClass(), message);
}
}
Aggregations