- Type Parameters:
C- connection type expected to handle the operations.T- the type of the returned pages.
This interface provides functionality for consuming a data feed in pages.
Instances should not be reused. Each execution of a paging operation should return different instances.
Implementing this interface does not guarantee thread safeness.
- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionvoidClosesthisprovider and all resources allocated by it, both local and remote.Returns the next page of items.getTotalResults(C connection) returns the total amount of items in the non-paged result set.default booleanSome systems require the same connection that obtained the first page to be used to fetch the subsequent ones.
-
Method Details
-
getPage
Returns the next page of items. If the return value is an emptyListthen it means no more items are available -
getTotalResults
returns the total amount of items in the non-paged result set. In some scenarios, it might not be possible/convenient to actually retrieve this value, in such a cases anOptional.empty()value is returned.- Parameters:
connection- The connection to be used to do the query.
-
useStickyConnections
default boolean useStickyConnections()Some systems require the same connection that obtained the first page to be used to fetch the subsequent ones. Although this is not the case of most APIs, this method allows to instruct the runtime to always feed the same connection into thegetPage(Object)method.Keep in mind that if the operation is participating in a transaction, then the connection will become sticky no matter what this method says.
This method is optional and defaults to
false- Returns:
- Whether all pages should be fetch using the same connection
-
close
Closesthisprovider and all resources allocated by it, both local and remote. This method should not try to also close theconnection, the runtime will do that when appropriate.- Parameters:
connection- The connection to be used in order to correctly close thePagingProvider.- Throws:
org.mule.runtime.api.exception.MuleException- if there was an error closing the resources
-