Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-13077

Olingo4 Consumer appears to not work with backoffIdleThreshold

    XMLWordPrintableJSON

    Details

    • Estimated Complexity:
      Unknown

      Description

      Looking into using backoffIdleThreshold for reducing the amount of polling of OData consuming. So far I cannot see how it would work for the Olingo4Consumer. Bear with me, this may get a little deep to follow!

      Hierarchy: ScheduledPollConsumer > AbstractApiConsumer > Olingo4Consumer

      SchedulePollConsumer maintains an idleCounter, which is incremented each time no messages are returned from polling. Once the idleCounter starts to increment then this in turn starts to increment the backoffCounter taking into account properties such as backoffIdleThreshold, resulting in delaying polling etc.

      However, in order for idleCounter to increment, poll() methods must return 0 messages. Since Olingo4Consumer defers its result[0] to ApiConsumer.getResultsProcessed(), the results must be in a form that can be handled by this static method, namely a List, an Iterable or an Array. Otherwise, the result is merely added to the Exchange and the constant '1' is returned.

      Now here is the crux. OData services like to return a ClientEntitySet hence when the result is passed to ApiConsumerHelper, it is none of the expected types and '1' is therefore always returned. Consequently, the return value of poll() is 1 hence idleCounter is never incremented.

      I hope that makes sense and if I have made a mistake then please let me know. I think the way to handle this would be to put the entities of the ClientEntitySet into the result rather than the set itself. That way ApiConsumerHelper would understand a Collection as an Iterable and return a proper value based on the size of the collection. Alternatively, if the ClientEntitySet is desired as the result then maybe ApiConsumerHelper needs to be extended in some way so as to correctly handle a return value for poll().

      Not sure which way to go on this so anxious to start a discussion.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dmvolod Dmitry Volodin
                Reporter:
                phantomjinx Paul Richardson
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m