use of org.graylog2.rest.models.system.inputs.responses.InputCreated in project graylog2-server by Graylog2.
the class InputEventListener method inputCreated.
@Subscribe
public void inputCreated(InputCreated inputCreatedEvent) {
final String inputId = inputCreatedEvent.id();
LOG.debug("Input created: {}", inputId);
final Input input;
try {
input = inputService.find(inputId);
} catch (NotFoundException e) {
LOG.warn("Received InputCreated event but could not find input {}", inputId, e);
return;
}
final IOState<MessageInput> inputState = inputRegistry.getInputState(inputId);
if (inputState != null) {
inputRegistry.remove(inputState);
}
if (input.isGlobal() || this.nodeId.toString().equals(input.getNodeId())) {
startInput(input);
}
}
use of org.graylog2.rest.models.system.inputs.responses.InputCreated in project graylog2-server by Graylog2.
the class InputStatesResource method start.
@PUT
@Path("/{inputId}")
@Timed
@ApiOperation(value = "(Re-)Start specified input on this node")
@ApiResponses(value = { @ApiResponse(code = 404, message = "No such input on this node.") })
@AuditEvent(type = AuditEventTypes.MESSAGE_INPUT_START)
public InputCreated start(@ApiParam(name = "inputId", required = true) @PathParam("inputId") String inputId) throws org.graylog2.database.NotFoundException {
checkPermission(RestPermissions.INPUTS_CHANGESTATE, inputId);
final Input input = inputService.find(inputId);
persistDesiredState(input, IOState.Type.RUNNING);
final InputCreated result = InputCreated.create(inputId);
this.serverEventBus.post(result);
return result;
}
Aggregations