@Subscribe public void inputCreated(InputCreated inputCreatedEvent) { LOG.debug("Input created/changed: " + inputCreatedEvent.id()); final Input input; try { input = inputService.find(inputCreatedEvent.id()); } catch (NotFoundException e) { LOG.warn("Received InputCreated event but could not find Input: ", e); return; } final IOState<MessageInput> inputState = inputRegistry.getInputState(inputCreatedEvent.id()); if (inputState != null) { inputRegistry.remove(inputState); } if (!input.isGlobal() && !this.nodeId.toString().equals(input.getNodeId())) { return; } final MessageInput messageInput; try { messageInput = inputService.getMessageInput(input); messageInput.initialize(); } catch (NoSuchInputTypeException e) { LOG.warn("Newly created input is of invalid type: " + input.getType(), e); return; } final IOState<MessageInput> newInputState = inputLauncher.launch(messageInput); inputRegistry.add(newInputState); }
@Subscribe public void inputDeleted(InputDeleted inputDeletedEvent) { LOG.debug("Input deleted: " + inputDeletedEvent.id()); final IOState<MessageInput> inputState = inputRegistry.getInputState(inputDeletedEvent.id()); if (inputState != null) { inputRegistry.remove(inputState); } }