Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
2.16.2
-
None
-
OpenJDK Runtime Environment (IcedTea 2.6.4) (Arch Linux build 7.u95_2.6.4-1-x86_64)
-
Unknown
Description
I've configured a polling Twitter endpoint with nearly default Spring configuration as follows:
from("twitter://search?type=polling&keywords=searchterms&delay=60&consumerKey=[s]&consumerSecret=[s]&accessToken=[s]&accessTokenSecret=[s]")
However, it doesn't seem to respect the delay parameter.
On debugging, the delay parameter is set properly:
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); }
but when the run() method of the ScheduledPollConsumer runs, the delay parameter is still the default of 500.
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); } }