Search in sources :

Example 1 with ReactingJob

use of com.bakdata.conquery.models.jobs.ReactingJob 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);
    }
}
Also used : MessageToManagerNode(com.bakdata.conquery.models.messages.network.MessageToManagerNode) ReactingJob(com.bakdata.conquery.models.jobs.ReactingJob) NetworkSession(com.bakdata.conquery.io.mina.NetworkSession) NetworkMessageContext(com.bakdata.conquery.models.messages.network.NetworkMessageContext) SlowMessage(com.bakdata.conquery.models.messages.SlowMessage)

Example 2 with ReactingJob

use of com.bakdata.conquery.models.jobs.ReactingJob in project conquery by bakdata.

the class ShardNode method messageReceived.

@Override
public void messageReceived(IoSession session, Object message) throws Exception {
    setLocation(session);
    if (!(message instanceof MessageToShardNode)) {
        log.error("Unknown message type {} in {}", message.getClass(), message);
        return;
    }
    MessageToShardNode srm = (MessageToShardNode) message;
    log.trace("{} recieved {} from {}", getName(), message.getClass().getSimpleName(), session.getRemoteAddress());
    ReactingJob<MessageToShardNode, ShardNodeNetworkContext> job = new ReactingJob<>(srm, context);
    if (((Message) message).isSlowMessage()) {
        ((SlowMessage) message).setProgressReporter(job.getProgressReporter());
        jobManager.addSlowJob(job);
    } else {
        jobManager.addFastJob(job);
    }
}
Also used : ReactingJob(com.bakdata.conquery.models.jobs.ReactingJob) MessageToShardNode(com.bakdata.conquery.models.messages.network.MessageToShardNode) Message(com.bakdata.conquery.models.messages.Message) SlowMessage(com.bakdata.conquery.models.messages.SlowMessage) ShardNodeNetworkContext(com.bakdata.conquery.models.messages.network.NetworkMessageContext.ShardNodeNetworkContext) SlowMessage(com.bakdata.conquery.models.messages.SlowMessage)

Aggregations

ReactingJob (com.bakdata.conquery.models.jobs.ReactingJob)2 SlowMessage (com.bakdata.conquery.models.messages.SlowMessage)2 NetworkSession (com.bakdata.conquery.io.mina.NetworkSession)1 Message (com.bakdata.conquery.models.messages.Message)1 MessageToManagerNode (com.bakdata.conquery.models.messages.network.MessageToManagerNode)1 MessageToShardNode (com.bakdata.conquery.models.messages.network.MessageToShardNode)1 NetworkMessageContext (com.bakdata.conquery.models.messages.network.NetworkMessageContext)1 ShardNodeNetworkContext (com.bakdata.conquery.models.messages.network.NetworkMessageContext.ShardNodeNetworkContext)1