Interface FeedProducerJournalRepository


  • public interface FeedProducerJournalRepository
    Repository to store rollback information for the feed producer.

    The feed producer uses this information to cleanly roll back partial changes in case of a crash or other interruption. The exact meaning of the stored fields is an implementation detail and might change (in a compatible way). The repository doesn't need to know what the fields mean, it just needs to save and load their values accurately.

    This repository always stores either zero or one records.

    Consistency Requirements

    In addition to the common requirements for all feed producer repositories, all writes to this repository must be atomic: get() may never observe a partially written or deleted state.
    • Method Detail

      • save

        @NonNull
        @NonNull java.util.concurrent.CompletionStage<java.lang.Void> save​(@NonNull
                                                                           @NonNull FeedProducerJournalRepository.JournalState state)
        Save the given journal state to the repository.

        This replaces the current entry, if any.

        Parameters:
        state - the entry to save
        Returns:
        CompletionStage
      • get

        @NonNull
        @NonNull java.util.concurrent.CompletionStage<@NonNull java.util.Optional<@NonNull FeedProducerJournalRepository.JournalState>> get()
        Get the currently stored journal state from the repository.

        This should either return the state passed to the most recent call to save(JournalState) or Optional.empty() if delete() was called most recently or save(JournalState) was never called

        Returns:
        CompletionStage of the currently stored journal state
      • delete

        @NonNull
        @NonNull java.util.concurrent.CompletionStage<java.lang.Void> delete()
        Delete the currently stored journal state from the repository.

        If there's no current entry (i.e. whenever get() returns nothing), this method is a no-op.

        Returns:
        CompletionStage