@Override public void cleanup() { processorRuntime.cleanup(); }
@Override public List<Result> process(StreamlineEvent inputEvent) throws ProcessingException { if (exception != null) { throw new RuntimeException(exception); } return processEvent(inputEvent); }
markWaitingSubprocess(); ProcessorMsg processorMsg = createProcessorMessage(inputEvent); shellProcess.writeProcessorMsg(processorMsg); throw new IllegalArgumentException("Command not found in shell message: " + shellMsg); setHeartbeat(); results.add(convertShellMsg(entry.getKey(), entry.getValue(), inputEvent)); throw new RuntimeException(processInfo, e); } finally { completedWaitingSubprocess();
public void prepare(Map stormConf, TopologyContext context, final OutputCollector collector) { super.prepare(stormConf, context, collector); rand = new Random(); ShellContext shellContext = getShellContext(context); Map<String, Object> processConfigMap = new HashMap<>(); processConfigMap.put(MultiLangProcessorRuntime.COMMAND, command.split(" ")); processConfigMap.put(MultiLangProcessorRuntime.PROCESS_CONFIG, stormConf); processConfigMap.put(MultiLangProcessorRuntime.SHELL_CONTEXT, shellContext); processConfigMap.put(MultiLangProcessorRuntime.OUTPUT_STREAMS, outputStreams); processConfigMap.put(MultiLangProcessorRuntime.PROCESS_TIMEOUT_MILLS, processTimeoutInMs); processConfigMap.put(MultiLangProcessorRuntime.SHELL_ENVIRONMENT, envMap); processorRuntime = new MultiLangProcessorRuntime(); processorRuntime.initialize(processConfigMap); }
private Result convertShellMsg(String stream, List<ShellMsg> shellMsgList, StreamlineEvent inputEvent) { List<StreamlineEvent> streamlineEvents = new LinkedList<>(); for (ShellMsg shellMsg: shellMsgList) { streamlineEvents.add(convertShellEvent(shellMsg.getStreamlineEvent(), inputEvent)); } return new Result(stream, streamlineEvents); }
@Override protected void process(Tuple input, StreamlineEvent event) { //just need an id StreamlineEvent eventWithStream = getStreamlineEventWithStream(event, input); try { for (Result result : processorRuntime.process(eventWithStream)) { for (StreamlineEvent e : result.events) { collector.emit(result.stream, input, new Values(e)); } } } catch (ProcessingException e) { throw new RuntimeException(e); } }