Interface EventLogRepository


  • public interface EventLogRepository
    This interface represents the database table where event log entries are stored. Normal users of the library don't need to care about this, it's implemented in nakadi-producer-spring-boot-starter and used in nakadi-producer. Only if you are using nakadi-producer without the spring-boot-starter, you'll have to implement it yourself.
    • Method Detail

      • findByLockedByAndLockedUntilGreaterThan

        Collection<EventLog> findByLockedByAndLockedUntilGreaterThan​(String lockId,
                                                                     Instant lockedUntil)
        Fetched events which were locked by the given lock ID, and whose lock is not yet expired.
        Parameters:
        lockId - the lock ID used for locking. This should be the same value as previously used in lockSomeMessages(String, Instant, Instant) for locking the event log entries.
        lockedUntil - A cut-off for the expiry time. Use a time here where you are reasonably confident that you can send out the fetched events until this time.
        Returns:
        the fetched events.
      • delete

        void delete​(EventLog eventLog)
        Deletes a single event log entry from the database.
        Parameters:
        eventLog - the event log entry. Only its id property is used.
      • delete

        default void delete​(Collection<EventLog> eventLogs)
        Deletes multiple event log entries.
        Parameters:
        eventLogs - A collection of event log entries. Only their id properties are be used.
      • persist

        void persist​(EventLog eventLog)
        Persists a single eventlog entry.
        Parameters:
        eventLog - the event log entry to insert into the database. It's not part of the contract to fill the id property with the generated identifier, but an implementation is free to do so. (The implementation in Nakadi-Producer Spring Boot Starter doesn't do so.)
      • persist

        default void persist​(Collection<EventLog> eventLogs)
        Persist multiple event log entries at once.
        Parameters:
        eventLogs - A collection of event logs entries. It's not part of the contract to fill the id property with the generated identifier, but an implementation is free to do so. (The implementation in Nakadi-Producer Spring Boot Starter doesn't do so.)
      • persistAndDelete

        default void persistAndDelete​(Collection<EventLog> eventLogs)
        Persists and immediately deletes some event log entries. This is meant to be used together with infrastructure listening to a logical DB replication stream.

        Implementer's note: The default implementation just calls persist(Collection) and delete(Collection) and will only work if persist stores back the IDs into the objects (which is not part of the contract). If that's not the case, this methods needs to be overridden to implement it in a different way.

        (The implementation in Nakadi-Producer Spring Boot starter reimplements this method.)
        Parameters:
        eventLogs - the event log entries to be persisted and deleted.
      • deleteAll

        void deleteAll()
        Deletes all event log entries. This is only meant for cleanup in tests.
      • findOne

        EventLog findOne​(Integer id)
        Fetches a specific event log by its ID. This is only meant to be used in tests.
        Parameters:
        id - the id attribute.
        Returns:
        the event log entry with the given ID, or null if there is none.