Interface IStreamConsumer<T>

Type Parameters:
T - the type of data being consumed
All Known Implementing Classes:
KafkaStreamConsumer

public interface IStreamConsumer<T>
Provide a consumer interface for reading data from streams.
Since:
24.4.0
  • Method Details

    • subscribe

      IStreamConsumer<T> subscribe(String topic)
      Subscribes to a single topic.
      Parameters:
      topic - the topic to subscribe to
      Returns:
      the stream consumer instance
    • subscribe

      IStreamConsumer<T> subscribe(List<String> topics)
      Subscribes to multiple topics.
      Parameters:
      topics - the list of topics to subscribe to
      Returns:
      the stream consumer instance
    • listStreams

      List<String> listStreams() throws StreamWakeupException
      Lists the streams available for consumption.
      Returns:
      a list of streams
      Throws:
      StreamWakeupException
    • wakeup

      void wakeup()
      Wakes up the consumer to process data.
    • shutdown

      void shutdown()
      shutdown the consumer.(This method will wake up stream consumer before closing)
    • close

      void close()
      Closes the consumer.
    • poll

      StreamData<T> poll(Duration duration) throws StreamWakeupException
      Polls data from the stream.
      Returns:
      the data polled from the stream
      Throws:
      StreamWakeupException - If wakeup method be called.