Class Publisher<T>

    • Constructor Detail

      • Publisher

        public Publisher()
    • Method Detail

      • withConsumer

        public Publisher<T> withConsumer​(Consumer<List<T>> consumer)
        Add the consumer of the data stream. The consumer will be called for each batch of T. This is potentially a blocking operation, so you should take care to process the batch efficiently (or spin off processing to a separate thread).
        Parameters:
        consumer - The function to call for each batch of T.
        Returns:
        The Publisher with the consumer configured.
      • withStartTime

        public Publisher<T> withStartTime​(Instant startTime)
        Sets the start time (i.e. the earliest possible created/changed time of the CDF Raw Row) of the data stream. The default start time is at Unix epoch. I.e. the publisher will read all existing rows (if any) in the raw table.
        Parameters:
        startTime - The start time instant
        Returns:
        The Publisher with the consumer configured.
      • withEndTime

        public Publisher<T> withEndTime​(Instant endTime)
        Sets the end time (i.e. the latest possible created/changed time of the CDF Raw Row) of the data stream. The default end time is Instant.MAX. I.e. the publisher will stream data indefinitely, or until aborted.
        Parameters:
        endTime - The end time instant
        Returns:
        The Publisher with the consumer configured.
      • withPollingInterval

        public Publisher<T> withPollingInterval​(Duration interval)
        Sets the polling interval to check for updates to the source raw table. The default polling interval is every 5 seconds. You can configure a more or less frequent interval, down to every 0.5 seconds.
        Parameters:
        interval - The interval to check the source raw table for updates.
        Returns:
        The Publisher with the consumer configured.
      • withPollingOffset

        public Publisher<T> withPollingOffset​(Duration interval)
        Sets the polling offset. The offset is a time window "buffer" subtracted from the current time when polling for data from CDF Raw. It is intended as a safeguard for clock differences between the client (running this publisher) and the CDF service. For example, if the polling offset is 2 seconds, then this publisher will look for data updates up to (and including) T-2 seconds. That is, data will be streamed with a 2 second fixed latency/delay.
        Parameters:
        interval - The interval to check the source raw table for updates.
        Returns:
        The Publisher with the consumer configured.
      • withRequest

        public Publisher<T> withRequest​(Request request)
        Sets a baseline Request to use when producing the steam of objects. The Request contains the set of filters that you want the (stream) objects to satisfy.
        Parameters:
        request - The baseline request specifying filters for the object stream.
        Returns:
        The Publisher with the consumer configured.