Class MongoInputStatusService

java.lang.Object
org.graylog2.inputs.persistence.MongoInputStatusService
All Implemented Interfaces:
InputStatusService

@Singleton public class MongoInputStatusService extends Object implements InputStatusService
This is a simple wrapper around MongoDB to allow storage of state data for stateful Inputs. Inputs using this service are responsible for defining their own model for InputStatusRecord.inputStateData
  • Field Details

  • Constructor Details

  • Method Details

    • get

      public Optional<InputStatusRecord> get(String inputId)
      Description copied from interface: InputStatusService
      Get the saved status record for an Input.
      Specified by:
      get in interface InputStatusService
      Parameters:
      inputId - ID of the input whose status you want to get
      Returns:
      The InputStatusRecord for the given Input ID if it exists; otherwise an empty Optional.
    • save

      public InputStatusRecord save(InputStatusRecord statusRecord)
      Description copied from interface: InputStatusService
      Save the status record for an Input.
      Specified by:
      save in interface InputStatusService
      Parameters:
      statusRecord - The Input status record to save
      Returns:
      A copy of the saved object
    • delete

      public int delete(String inputId)
      Description copied from interface: InputStatusService
      Remove the status record for a given Input
      Specified by:
      delete in interface InputStatusService
      Parameters:
      inputId - ID of the input whose status you want to delete
      Returns:
      The count of deleted objects (should be 0 or 1)
    • handleInputDeleted

      public void handleInputDeleted(InputDeleted event)
      Clean up MongoDB records when Inputs are deleted At the moment, Graylog uses the InputDeleted event both when an Input is stopped and when it is deleted.
      Parameters:
      event - ID of the input being deleted