Package org.graylog2.inputs.persistence
Class MongoInputStatusService
java.lang.Object
org.graylog2.inputs.persistence.MongoInputStatusService
- All Implemented Interfaces:
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 Summary
-
Constructor Summary
ConstructorDescriptionMongoInputStatusService
(MongoConnection mongoConnection, MongoJackObjectMapperProvider objectMapperProvider, InputService inputService, com.google.common.eventbus.EventBus eventBus) -
Method Summary
Modifier and TypeMethodDescriptionint
Remove the status record for a given InputGet the saved status record for an Input.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.save
(InputStatusRecord statusRecord) Save the status record for an Input.
-
Field Details
-
COLLECTION_NAME
- See Also:
-
-
Constructor Details
-
MongoInputStatusService
@Inject public MongoInputStatusService(MongoConnection mongoConnection, MongoJackObjectMapperProvider objectMapperProvider, InputService inputService, com.google.common.eventbus.EventBus eventBus)
-
-
Method Details
-
get
Description copied from interface:InputStatusService
Get the saved status record for an Input.- Specified by:
get
in interfaceInputStatusService
- 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
Description copied from interface:InputStatusService
Save the status record for an Input.- Specified by:
save
in interfaceInputStatusService
- Parameters:
statusRecord
- The Input status record to save- Returns:
- A copy of the saved object
-
delete
Description copied from interface:InputStatusService
Remove the status record for a given Input- Specified by:
delete
in interfaceInputStatusService
- Parameters:
inputId
- ID of the input whose status you want to delete- Returns:
- The count of deleted objects (should be 0 or 1)
-
handleInputDeleted
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
-