Interface ProducerIterator<M extends Message>

All Superinterfaces:
AutoCloseable, Iterator<M>
All Known Implementing Classes:
AbstractProducer, FileBlobMessageProducer, RandomDocumentMessageProducer, RandomStringBlobMessageProducer

public interface ProducerIterator<M extends Message> extends Iterator<M>, AutoCloseable
A ProducerIterator returns Message. It also has the logic to return a partition index, that will be used to run concurrent consumers.
Since:
9.1
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    getPartition(M message, int partitions)
    Returns a partition associated with the Message.
    default void
    The remove method is not needed.

    Methods inherited from interface java.lang.AutoCloseable

    close

    Methods inherited from interface java.util.Iterator

    forEachRemaining, hasNext, next
  • Method Details

    • remove

      default void remove()
      The remove method is not needed.
      Specified by:
      remove in interface Iterator<M extends Message>
    • getPartition

      int getPartition(M message, int partitions)
      Returns a partition associated with the Message. The value returned must be between 0 and lower than partitions.
      Parameters:
      message - the message to shard
      partitions - the number of partitions