Interface MessageIterator<T>

  • All Superinterfaces:
    java.lang.AutoCloseable, java.io.Closeable, java.util.Iterator<T>

    public interface MessageIterator<T>
    extends java.util.Iterator<T>, java.io.Closeable

    A MessageIterator is provided by a MessageConnector and is used to retrieve and process messages from an external source and also to remove them from the underlying source after being processed successfully.

    Since:
    10.0.46
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default void close()
      After each fetch period the close() method will be called to indicate the end of the iteration and therefore also the end of the MessageIterator's life cycle.
      default int getAvailableCount()
      This method is called before the iteration.
      default T next​(NextMessageInfo nextMessageInfo)
      Returns the next element in the iteration.
      void remove()
      After a message, that had been previously retrieved by calling the next() method, has been successfully processed, the remove() method may be called to delete the message permanently from the source.
      • Methods inherited from interface java.util.Iterator

        forEachRemaining, hasNext, next
    • Method Detail

      • next

        default T next​(NextMessageInfo nextMessageInfo)
        Returns the next element in the iteration. The parameter NextMessageInfo provides access to the IntermediateStorage and IncomingBindings object.
        Parameters:
        nextMessageInfo - the NextMessageInfo object provides additional information during retrieval of the next message
        Returns:
        the next element in the iteration
        Throws:
        java.util.NoSuchElementException - if the iteration has no more elements
        Since:
        11.32
      • remove

        void remove()
        After a message, that had been previously retrieved by calling the next() method, has been successfully processed, the remove() method may be called to delete the message permanently from the source. After a message has been deleted by calling the remove() method it must not be retrieved again by any MessageIterator in the future. If the remove() is not called for a message, it has to be retrieved again by the next instance of MessageIterator
        Specified by:
        remove in interface java.util.Iterator<T>
        Since:
        10.0.46
      • close

        default void close()
        After each fetch period the close() method will be called to indicate the end of the iteration and therefore also the end of the MessageIterator's life cycle. All further messages, that haven't been processed yet, will be processed during the next fetch period. Closes also any underlying resources associated with this iterator.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Since:
        10.0.46
      • getAvailableCount

        default int getAvailableCount()
        This method is called before the iteration. The value doesn't need to be kept up to date during the iteration. Calling this method does not affect the iterator. This method will return -1, if it is not possible or too expensive to get the number of elements.
        Returns:
        The number of elements for the iteration. The default implementation will always return -1.
        Since:
        10.0.132