This is an automated email from the ASF dual-hosted git repository. dmvolod pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new f7d1025 CAMEL-13077: Fix polling return for empty OData ODataFeeds (#2719) Closes #2732 f7d1025 is described below commit f7d102597776b8a2e1d95843931dba1df0e568e2 Author: phantomjinx <p.g.richard...@phantomjinx.co.uk> AuthorDate: Thu Jan 24 11:54:19 2019 +0000 CAMEL-13077: Fix polling return for empty OData ODataFeeds (#2719) Closes #2732 * ApiConsumerHelper does not recognise ODataFeeds and thus defaults to return a constant 1. This means that the scheduling polling is never concluded to be idle and the backoffXXX consumer properties do not work. * If the ODataFeed is empty then return 0 to allow for backoffXXX properties * This is an equivalent change to that already committed for olingo4 component. --- .../org/apache/camel/component/olingo2/Olingo2Consumer.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Consumer.java b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Consumer.java index 81763b0..ff2c294 100644 --- a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Consumer.java +++ b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Consumer.java @@ -19,13 +19,13 @@ package org.apache.camel.component.olingo2; import java.util.HashMap; import java.util.Map; import java.util.concurrent.CountDownLatch; - import org.apache.camel.Processor; import org.apache.camel.RuntimeCamelException; import org.apache.camel.component.olingo2.api.Olingo2ResponseHandler; import org.apache.camel.component.olingo2.internal.Olingo2ApiName; import org.apache.camel.support.component.AbstractApiConsumer; import org.apache.camel.support.component.ApiConsumerHelper; +import org.apache.olingo.odata2.api.ep.feed.ODataFeed; /** * The Olingo2 consumer. @@ -81,7 +81,15 @@ public class Olingo2Consumer extends AbstractApiConsumer<Olingo2ApiName, Olingo2 throw error[0]; } - return ApiConsumerHelper.getResultsProcessed(this, result[0], isSplitResult()); + // + // Allow consumer idle properties to properly handle an empty polling response + // + if (result[0] instanceof ODataFeed && (((ODataFeed) result[0]).getEntries().isEmpty())) { + return 0; + } else { + int processed = ApiConsumerHelper.getResultsProcessed(this, result[0], isSplitResult()); + return processed; + } } catch (Throwable t) { throw RuntimeCamelException.wrapRuntimeCamelException(t);