private void querySubprocess() {
try {
_process.writeSpoutMsg(_spoutMsg);
while (true) {
ShellMsg shellMsg = _process.readShellMsg();
String command = shellMsg.getCommand();
if (command.equals("sync")) {
return;
} else if (command.equals("log")) {
String msg = shellMsg.getMsg();
LOG.info("Shell msg: " + msg);
} else if (command.equals("emit")) {
String stream = shellMsg.getStream();
Long task = shellMsg.getTask();
List<Object> tuple = shellMsg.getTuple();
Object messageId = shellMsg.getId();
if (task == 0) {
List<Integer> outtasks = _collector.emit(stream, tuple, messageId);
if (shellMsg.areTaskIdsNeeded()) {
_process.writeTaskIds(outtasks);
}
} else {
_collector.emitDirect((int) task.longValue(), stream, tuple, messageId);
}