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 aMessageConnector
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 theclose()
method will be called to indicate the end of the iteration and therefore also the end of theMessageIterator
'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 thenext()
method, has been successfully processed, theremove()
method may be called to delete the message permanently from the source.
-
-
-
Method Detail
-
next
default T next(NextMessageInfo nextMessageInfo)
Returns the next element in the iteration. The parameterNextMessageInfo
provides access to theIntermediateStorage
andIncomingBindings
object.- Parameters:
nextMessageInfo
- theNextMessageInfo
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 thenext()
method, has been successfully processed, theremove()
method may be called to delete the message permanently from the source. After a message has been deleted by calling theremove()
method it must not be retrieved again by anyMessageIterator
in the future. If theremove()
is not called for a message, it has to be retrieved again by the next instance ofMessageIterator
- Specified by:
remove
in interfacejava.util.Iterator<T>
- Since:
- 10.0.46
-
close
default void close()
After each fetch period theclose()
method will be called to indicate the end of the iteration and therefore also the end of theMessageIterator
'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 interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.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
-
-