How to limit the number of results

By default, there is no constraint on the result size of queries, nonetheless, it is possible to limit the result size by adding a parameter maxRowCount in the URI of the query:
Result limit entry
<to uri="tnd-query:GetPaymentsFilteredByCreationTime?maxRowCount=10"/>

Using the above URI, the result will be limited to 10 rows.


As a reminder, the following example shows how this value would be used in a route.

Route with result limit
<routes xmlns="" xmlns:u="">
        <from uri="timer:foo?repeatCount=1"/>
        <!-- Parameter map for query-->
        <setProperty name="tnd-query.parameters">
                <u:map-entry key="tnd-query.referenceTime">
                <u:map-entry key="intersectsInterval"> <!-- alias of the parameter created in the data query -->
                    <!-- chosen function "INTERSECTS" neeeds an interval as input. We build it using the dedicated Camel Utility Expression -->   
        <to uri="tnd-query:GetPaymentsFilteredByCreationTime?maxRowCount=10"/>
        <log message="${body}"/>

Related Links