Package org.graylog.events.processor
Class DBEventProcessorStateService
java.lang.Object
org.graylog.events.processor.DBEventProcessorStateService
Manages database state for
EventProcessor
s.-
Constructor Summary
ConstructorDescriptionDBEventProcessorStateService
(MongoConnection mongoConnection, MongoJackObjectMapperProvider mapper) -
Method Summary
Modifier and TypeMethodDescriptionint
Delete state objects for the given event definition ID.com.google.common.collect.ImmutableSet<EventProcessorStateDto>
findByEventDefinitionsAndMaxTimestamp
(Set<String> eventDefinitionIds, org.joda.time.DateTime maxTimestamp) Returns a set of event processor state objects where the event definition ID matches one of the ones in the given set of IDs and the maximum processed timestamp is greater or equals the given timestamp.setState
(String eventDefinitionId, org.joda.time.DateTime minProcessedTimestamp, org.joda.time.DateTime maxProcessedTimestamp) Creates a new or updates an existing event processor state record for the given values.Creates a new or updates an existing event processor state record for the values in the given DTO.
-
Constructor Details
-
DBEventProcessorStateService
@Inject public DBEventProcessorStateService(MongoConnection mongoConnection, MongoJackObjectMapperProvider mapper)
-
-
Method Details
-
findByEventDefinitionsAndMaxTimestamp
public com.google.common.collect.ImmutableSet<EventProcessorStateDto> findByEventDefinitionsAndMaxTimestamp(Set<String> eventDefinitionIds, org.joda.time.DateTime maxTimestamp) Returns a set of event processor state objects where the event definition ID matches one of the ones in the given set of IDs and the maximum processed timestamp is greater or equals the given timestamp.- Parameters:
eventDefinitionIds
- set of event definition IDsmaxTimestamp
- the threshold for the maximum processed timestamp- Returns:
- set of state objects or empty set when no object matches
-
setState
Creates a new or updates an existing event processor state record for the values in the given DTO.- Parameters:
dto
- state DTO- Returns:
- the created or updated record
-
setState
public Optional<EventProcessorStateDto> setState(String eventDefinitionId, org.joda.time.DateTime minProcessedTimestamp, org.joda.time.DateTime maxProcessedTimestamp) Creates a new or updates an existing event processor state record for the given values.- Parameters:
eventDefinitionId
- the related event definition IDmaxProcessedTimestamp
- the maximum processed timestamp- Returns:
- the created or updated record
-
deleteByEventDefinitionId
Delete state objects for the given event definition ID.- Parameters:
id
- the object ID to delete- Returns:
- the number of objects that have been deleted
-