Search in sources :

Example 1 with NoopInterpreterListener

use of org.graylog.plugins.pipelineprocessor.processors.listeners.NoopInterpreterListener in project graylog2-server by Graylog2.

the class PipelineProcessorMessageDecorator method apply.

@Override
public SearchResponse apply(SearchResponse searchResponse) {
    final List<ResultMessageSummary> results = new ArrayList<>();
    if (pipelines.isEmpty()) {
        return searchResponse;
    }
    searchResponse.messages().forEach((inMessage) -> {
        final Message message = new Message(inMessage.message());
        final List<Message> additionalCreatedMessages = pipelineInterpreter.processForPipelines(message, pipelines, new NoopInterpreterListener(), pipelineStateUpdater.getLatestState());
        results.add(ResultMessageSummary.create(inMessage.highlightRanges(), message.getFields(), inMessage.index()));
        additionalCreatedMessages.forEach((additionalMessage) -> {
            // TODO: pass proper highlight ranges. Need to rebuild them for new messages.
            results.add(ResultMessageSummary.create(ImmutableMultimap.of(), additionalMessage.getFields(), "[created from decorator]"));
        });
    });
    return searchResponse.toBuilder().messages(results).build();
}
Also used : Message(org.graylog2.plugin.Message) NoopInterpreterListener(org.graylog.plugins.pipelineprocessor.processors.listeners.NoopInterpreterListener) ArrayList(java.util.ArrayList) ResultMessageSummary(org.graylog2.rest.models.messages.responses.ResultMessageSummary)

Aggregations

ArrayList (java.util.ArrayList)1 NoopInterpreterListener (org.graylog.plugins.pipelineprocessor.processors.listeners.NoopInterpreterListener)1 Message (org.graylog2.plugin.Message)1 ResultMessageSummary (org.graylog2.rest.models.messages.responses.ResultMessageSummary)1