Class EventIdRepository
java.lang.Object
es.kukenan.smartfi.kafka.repository.EventIdRepository
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean
public class EventIdRepository
extends Object
implements org.springframework.beans.factory.InitializingBean
EventId repository, use to register the processed events and avoid duplicated execution.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringThe name of the eventId collection.private com.mongodb.client.MongoCollection<org.bson.Document>The eventId collection in the Mongo database.private StringThe collection index required to implement the TTL.private org.springframework.data.mongodb.MongoDatabaseFactoryMongo database connection factory.private longThe time to live for collection entries.private StringThe time to live unit for collection entries. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidRemove all the eventIds in the collection.Store the eventId, fails if is already exists.
-
Field Details
-
collectionName
The name of the eventId collection. -
ttl
@Value("${kafka.event.idStorage.ttl}") private long ttlThe time to live for collection entries. -
ttlUnit
The time to live unit for collection entries. -
indexName
The collection index required to implement the TTL. -
mongo
@Autowired private org.springframework.data.mongodb.MongoDatabaseFactory mongoMongo database connection factory. -
eventIdCollection
private com.mongodb.client.MongoCollection<org.bson.Document> eventIdCollectionThe eventId collection in the Mongo database.
-
-
Constructor Details
-
EventIdRepository
public EventIdRepository()
-
-
Method Details
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
save
Store the eventId, fails if is already exists.- Parameters:
eventId- the eventId entity.- Returns:
- the stored entity.
-
deleteAll
public void deleteAll()Remove all the eventIds in the collection.
-