You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "John Liptak (JIRA)" <ji...@apache.org> on 2013/06/17 22:12:21 UTC

[jira] [Commented] (CAMEL-6465) Add greedy option to ScheduledPollConsumer

    [ https://issues.apache.org/jira/browse/CAMEL-6465?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13685921#comment-13685921 ] 

John Liptak commented on CAMEL-6465:
------------------------------------

While doing performance testing on the JPA component, I found significant performance benefits resulted from 
adding an optional "greedy" flag for use in the batch subclass.  The behavior is that if messages are processed, rather than yielding, go back for more work.  For database polling work this has two advantages:
1. you can keep the polling slower so you don't skew your database monitoring with "do you have work".
2. you can keep your batch size smaller, allowing you to ensure that batches fit in memory.

add 
    private boolean greedy = false;
plus getters and setters
and change doRun() from
...
                            if (polledMessages == 0 && isSendEmptyMessageWhenIdle()) {
                                // send an "empty" exchange
                                processEmptyMessage();
                            }
...
to
...
                            if (polledMessages == 0 && isSendEmptyMessageWhenIdle()) {
                                // send an "empty" exchange
                                processEmptyMessage();
                            } else if(polledMessages > 0  && greedy){
                            	done = false; // loop again
                            	retryCounter = -1;
                            	LOG.trace("Greedy polling after processing {} messages", polledMessages);
                            }
...


                
> Add greedy option to ScheduledPollConsumer
> ------------------------------------------
>
>                 Key: CAMEL-6465
>                 URL: https://issues.apache.org/jira/browse/CAMEL-6465
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.10.4
>            Reporter: John Liptak
>            Priority: Minor
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira