Search in sources :

Example 1 with InputUpdated

use of org.graylog2.rest.models.system.inputs.responses.InputUpdated in project graylog2-server by Graylog2.

the class InputEventListener method inputUpdated.

@Subscribe
public void inputUpdated(InputUpdated inputUpdatedEvent) {
    final String inputId = inputUpdatedEvent.id();
    LOG.debug("Input updated: {}", inputId);
    final Input input;
    try {
        input = inputService.find(inputId);
    } catch (NotFoundException e) {
        LOG.warn("Received InputUpdated event but could not find input {}", inputId, e);
        return;
    }
    final boolean startInput;
    final IOState<MessageInput> inputState = inputRegistry.getInputState(inputId);
    if (inputState != null) {
        startInput = inputState.getState() == IOState.Type.RUNNING;
        inputRegistry.remove(inputState);
    } else {
        startInput = false;
    }
    if (startInput && (input.isGlobal() || this.nodeId.toString().equals(input.getNodeId()))) {
        startInput(input);
    }
}
Also used : MessageInput(org.graylog2.plugin.inputs.MessageInput) NotFoundException(org.graylog2.database.NotFoundException) MessageInput(org.graylog2.plugin.inputs.MessageInput) Subscribe(com.google.common.eventbus.Subscribe)

Aggregations

Subscribe (com.google.common.eventbus.Subscribe)1 NotFoundException (org.graylog2.database.NotFoundException)1 MessageInput (org.graylog2.plugin.inputs.MessageInput)1