camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] [Assigned] (CAMEL-9553) Twitter consumer doesn't respect the delay parameter
Date Mon, 01 Feb 2016 08:34:39 GMT

     [ https://issues.apache.org/jira/browse/CAMEL-9553?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Claus Ibsen reassigned CAMEL-9553:
----------------------------------

    Assignee: Claus Ibsen

> Twitter consumer doesn't respect the delay parameter
> ----------------------------------------------------
>
>                 Key: CAMEL-9553
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9553
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-twitter
>    Affects Versions: 2.16.2
>         Environment: OpenJDK Runtime Environment (IcedTea 2.6.4) (Arch Linux build 7.u95_2.6.4-1-x86_64)
>            Reporter: Justin W
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.17.0
>
>
> I've configured a polling Twitter endpoint with nearly default Spring configuration as
follows:
> {code}
> from("twitter://search?type=polling&keywords=searchterms&delay=60&consumerKey=[s]&consumerSecret=[s]&accessToken=[s]&accessTokenSecret=[s]")
> {code}
> However, it doesn't seem to respect the delay parameter.
> On debugging, the delay parameter is set properly:
> {code}
>     public TwitterConsumerPolling(TwitterEndpoint endpoint, Processor processor,
>                                   Twitter4JConsumer twitter4jConsumer) {
>         super(endpoint, processor);
>         this.twitter4jConsumer = twitter4jConsumer;
>         int delay = endpoint.getProperties().getDelay();
>         setInitialDelay(1);
>         setDelay(delay);  // delay is set properly to 60 here
>         setTimeUnit(TimeUnit.SECONDS);
>     }
> {code}
> but when the run() method of the ScheduledPollConsumer runs, the delay parameter is still
the default of 500.
> {code}
> public void run() {
>         // avoid this thread to throw exceptions because the thread pool wont re-schedule
a new thread
>         try {
>             // log starting
>             if (LoggingLevel.ERROR == runLoggingLevel) {
>                 LOG.error("Scheduled task started on:   {}", this.getEndpoint());
>             } else if (LoggingLevel.WARN == runLoggingLevel) {
>                 LOG.warn("Scheduled task started on:   {}", this.getEndpoint());
>             } else if (LoggingLevel.INFO == runLoggingLevel) {
>                 LOG.info("Scheduled task started on:   {}", this.getEndpoint());
>             } else if (LoggingLevel.DEBUG == runLoggingLevel) {
>                 LOG.debug("Scheduled task started on:   {}", this.getEndpoint());
>             } else {
>                 LOG.trace("Scheduled task started on:   {}", this.getEndpoint());
>             }
>             // execute scheduled task
>             doRun();
>             // log completed
>             if (LoggingLevel.ERROR == runLoggingLevel) {
>                 LOG.error("Scheduled task completed on: {}", this.getEndpoint());
>             } else if (LoggingLevel.WARN == runLoggingLevel) {
>                 LOG.warn("Scheduled task completed on: {}", this.getEndpoint());
>             } else if (LoggingLevel.INFO == runLoggingLevel) {
>                 LOG.info("Scheduled task completed on: {}", this.getEndpoint());
>             } else if (LoggingLevel.DEBUG == runLoggingLevel) {
>                 LOG.debug("Scheduled task completed on: {}", this.getEndpoint());
>             } else {
>                 LOG.trace("Scheduled task completed on: {}", this.getEndpoint());
>             }
>         } catch (Error e) {
>             // must catch Error, to ensure the task is re-scheduled
>             LOG.error("Error occurred during running scheduled task on: " + this.getEndpoint()
+ ", due: " + e.getMessage(), e);
>         }
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message