Interface CommitLogReader

    • Method Detail

      • getUri

        java.net.URI getUri()
        Retrieve URI representing this resource.
        Returns:
        URI representing this resource
      • getPartitions

        java.util.List<Partition> getPartitions()
        Retrieve list of partitions of this commit log.
        Returns:
        list of partitions of this reader
      • observe

        ObserveHandle observe​(java.lang.String name,
                              Position position,
                              CommitLogObserver observer)
        Subscribe observer by name to the commit log. Each observer maintains its own position in the commit log, so that the observers with different names do not interfere If multiple observers share the same name, then the ingests are load-balanced between them (in an undefined manner). This is a non blocking call.
        Parameters:
        name - identifier of the consumer
        position - the position to seek for in the commit log
        observer - the observer to subscribe to the commit log
        Returns:
        ObserveHandle to asynchronously cancel the observation
      • observe

        default ObserveHandle observe​(java.lang.String name,
                                      CommitLogObserver observer)
        Subscribe observer by name to the commit log and read the newest data. Each observer maintains its own position in the commit log, so that the observers with different names do not interfere If multiple observers share the same name, then the ingests are load-balanced between them (in an undefined manner). This is a non blocking call.
        Parameters:
        name - identifier of the consumer
        observer - the observer to subscribe to the commit log
        Returns:
        ObserveHandle to asynchronously cancel the observation
      • observePartitions

        ObserveHandle observePartitions​(java.lang.String name,
                                        java.util.Collection<Partition> partitions,
                                        Position position,
                                        boolean stopAtCurrent,
                                        CommitLogObserver observer)
        Subscribe to given set of partitions. If you use this call then the reader stops being automatically load balanced and the set of partitions can only be changed by call to this method again.
        Parameters:
        name - name of the observer
        partitions - the list of partitions to subscribe to
        position - the position to seek to in the partitions
        stopAtCurrent - when true then stop the observer as soon as it reaches most recent record
        observer - the observer to subscribe to the partitions
        Returns:
        ObserveHandle to asynchronously cancel the observation
      • observePartitions

        default ObserveHandle observePartitions​(java.util.Collection<Partition> partitions,
                                                Position position,
                                                boolean stopAtCurrent,
                                                CommitLogObserver observer)
        Subscribe to given set of partitions. If you use this call then the reader stops being automatically load balanced and the set of partitions can only be changed by call to this method again.
        Parameters:
        partitions - the list of partitions to subscribe to
        position - the position to seek to in the partitions
        stopAtCurrent - when true then stop the observer as soon as it reaches most recent record
        observer - the observer to subscribe to the partitions
        Returns:
        ObserveHandle to asynchronously cancel the observation
      • observePartitions

        default ObserveHandle observePartitions​(java.util.Collection<Partition> partitions,
                                                Position position,
                                                CommitLogObserver observer)
        Subscribe to given set of partitions. If you use this call then the reader stops being automatically load balanced and the set of partitions can only be changed by call to this method again.
        Parameters:
        partitions - the list of partitions to subscribe to
        position - the position to seek to in the partitions
        observer - the observer to subscribe to the partitions
        Returns:
        ObserveHandle to asynchronously cancel the observation
      • observePartitions

        default ObserveHandle observePartitions​(java.util.Collection<Partition> partitions,
                                                CommitLogObserver observer)
        Subscribe to given set of partitions and read newest data. If you use this call then the reader stops being automatically load balanced and the set of partitions can only be changed by call to this method again.
        Parameters:
        partitions - the partitions to subscribe to
        observer - the observer to subscribe to the given partitions
        Returns:
        ObserveHandle to asynchronously cancel the observation
      • observeBulk

        ObserveHandle observeBulk​(java.lang.String name,
                                  Position position,
                                  boolean stopAtCurrent,
                                  CommitLogObserver observer)
        Subscribe to the commit log in a bulk fashion. That implies that elements are not committed one-by-one, but in a bulks, where all elements in a bulk are committed at once. This is useful for micro-batching approach of data processing.
        Parameters:
        name - name of the observer
        position - the position to seek to in the partitions
        stopAtCurrent - when true then stop the observer as soon as it reaches most recent record
        observer - the observer to subscribe
        Returns:
        ObserveHandle to asynchronously cancel the observation
      • observeBulk

        default ObserveHandle observeBulk​(java.lang.String name,
                                          Position position,
                                          CommitLogObserver observer)
        Subscribe to the commit log in a bulk fashion. That implies that elements are not committed one-by-one, but in a bulks, where all elements in a bulk are committed at once. This is useful for micro-batching approach of data processing.
        Parameters:
        name - name of the observer
        position - the position to seek to in the partitions
        observer - the observer to subscribe
        Returns:
        ObserveHandle to asynchronously cancel the observation
      • observeBulk

        default ObserveHandle observeBulk​(java.lang.String name,
                                          CommitLogObserver observer)
        Subscribe to the commit log in a bulk fashion from newest data. That implies that elements are not committed one-by-one, but in a bulks, where all elements in a bulk are committed at once. This is useful for micro-batching approach of data processing.
        Parameters:
        name - name of the observer
        observer - the observer to subscribe
        Returns:
        ObserveHandle to asynchronously cancel the observation
      • observeBulkPartitions

        default ObserveHandle observeBulkPartitions​(java.lang.String name,
                                                    java.util.Collection<Partition> partitions,
                                                    Position position,
                                                    CommitLogObserver observer)
        Subscribe to given partitions in a bulk fashion.
        Parameters:
        name - name of the observer
        partitions - the partitions to subscribe to
        position - the position to seek to in the partitions
        observer - the observer to subscribe to the partitions
        Returns:
        ObserveHandle to asynchronously cancel the observation
      • observeBulkPartitions

        ObserveHandle observeBulkPartitions​(java.lang.String name,
                                            java.util.Collection<Partition> partitions,
                                            Position position,
                                            boolean stopAtCurrent,
                                            CommitLogObserver observer)
        Subscribe to given partitions in a bulk fashion.
        Parameters:
        name - name of the observer
        partitions - the partitions to subscribe to
        position - the position to seek to in the partitions
        stopAtCurrent - when true then stop the observer as soon as it reaches most recent record
        observer - the observer to subscribe to the partitions
        Returns:
        ObserveHandle to asynchronously cancel the observation
      • observeBulkPartitions

        default ObserveHandle observeBulkPartitions​(java.util.Collection<Partition> partitions,
                                                    Position position,
                                                    boolean stopAtCurrent,
                                                    CommitLogObserver observer)
        Subscribe to given partitions in a bulk fashion.
        Parameters:
        partitions - the partitions to subscribe to
        position - the position to seek to in the partitions
        stopAtCurrent - when true then stop the observer as soon as it reaches most recent record
        observer - the observer to subscribe to the partitions
        Returns:
        ObserveHandle to asynchronously cancel the observation
      • observeBulkPartitions

        default ObserveHandle observeBulkPartitions​(java.util.Collection<Partition> partitions,
                                                    Position position,
                                                    CommitLogObserver observer)
        Subscribe to given partitions in a bulk fashion.
        Parameters:
        partitions - the partitions to subscribe to
        position - the position to seek to in the partitions
        observer - the observer to subscribe to the partitions
        Returns:
        ObserveHandle to asynchronously cancel the observation
      • hasExternalizableOffsets

        default boolean hasExternalizableOffsets()
        Signals the user that offsets used by this reader can be externalized and reused later.
        Returns:
        true if Offsets of this reader are externalizable
      • restoresSequentialIds

        default boolean restoresSequentialIds()
        Signals the user that this CommitLogReader is able to recover sequential IDs sent to it in StreamElements through its associated writer.
        Returns:
        true if StreamElement read from the commit log contain valid sequential IDs.
      • fetchOffsets

        default java.util.Map<Partition,​Offset> fetchOffsets​(Position position,
                                                                   java.util.List<Partition> partitions)
        Fetch offsets at given position from given partitions.
        Parameters:
        position - position of the offsets
        partitions - partitions for which to fetch the offsets
        Throws:
        java.lang.UnsupportedOperationException - if CommitLogReader does not have externalizable offsets