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 Details

    • collectionName

      @Value("${kafka.event.idStorage.collection}") private String collectionName
      The name of the eventId collection.
    • ttl

      @Value("${kafka.event.idStorage.ttl}") private long ttl
      The time to live for collection entries.
    • ttlUnit

      @Value("${kafka.event.idStorage.ttl.unit}") private String ttlUnit
      The time to live unit for collection entries.
    • indexName

      @Value("${kafka.event.idStorage.ttl.indexName}") private String indexName
      The collection index required to implement the TTL.
    • mongo

      @Autowired private org.springframework.data.mongodb.MongoDatabaseFactory mongo
      Mongo database connection factory.
    • eventIdCollection

      private com.mongodb.client.MongoCollection<org.bson.Document> eventIdCollection
      The eventId collection in the Mongo database.
  • Constructor Details

    • EventIdRepository

      public EventIdRepository()
  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • save

      public EventId save(EventId eventId)
      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.