Note that there are some explanatory texts on larger screens.

plurals
  1. POStop route when all messages are filtered
    primarykey
    data
    text
    <p>I have a batch route that consumes XML files from a folder. It filters, transforms and finally saves a grouped document to disk. As this is a batch route, I require it to be shut down after a single polling of the sourcefolder, which is what the RouteTerminator is for in the code below. (It calls <code>stopRoute()</code> and <code>removeRoute()</code> on <code>camelContext</code> with <code>routeID</code>.)</p> <pre><code>from("file:" + sourcePath) .filter().xquery("//DateTime &gt; xs:dateTime('2013-05-07T23:59:59')") .filter().xquery("//DateTime &lt; xs:dateTime('2013-05-09T00:00:00')") .aggregate(constant(true)) .completionFromBatchConsumer() .groupExchanges() .to("xquery:" + xqueryPath) .to("file:" + targetPath) .process(new Processor() { @Override public void process(Exchange exchange) throws Exception { new RouteTerminator(routeID, exchange.getContext()).start(); } }) .end(); </code></pre> <p>This correctly closes the route after a single file collection and after repeating the process in <code>onException</code> it also gracefully closes the route when an exception is thrown. Unfortunately, if the route filters out every Exchange, it never reaches the processor. Exchanges are instead dropped during the filter and the route remains open.</p> <p>I thought to move the filter inside the <code>aggregate</code> call as this might keep the route going until the end, but this method won't accept XQuery filters. XPath is not an option as it does not support dateTime comparisons.</p> <p>How can I force the entire route to stop in this case?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload