Search in sources :

Example 1 with Message

use of com.bakdata.conquery.models.messages.Message 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)1 Message (com.bakdata.conquery.models.messages.Message)1 SlowMessage (com.bakdata.conquery.models.messages.SlowMessage)1 MessageToShardNode (com.bakdata.conquery.models.messages.network.MessageToShardNode)1 ShardNodeNetworkContext (com.bakdata.conquery.models.messages.network.NetworkMessageContext.ShardNodeNetworkContext)1